Show Posts
Pages: 1 [2] 3 4 ... 12
16  Using Arduino / Project Guidance / Re: Code for Panning/Tilting on: October 06, 2012, 04:41:08 pm
Pan and tilting refer to the way the servo is mounted, nothing in software that's special.

You would do well to read:
17  Using Arduino / Motors, Mechanics, and Power / Re: Need help to assemble my dc motor to my arduino w/ relay switch on: October 06, 2012, 04:18:10 pm
18  Using Arduino / Programming Questions / Re: A latching trigger on: October 06, 2012, 08:53:18 am
Why use an encoder rather than a standard potentiometer? Seems like as a beginner to coding this sort of stuff processing the analog in from a pot will be much easier than following the flow of an encoder.

How are your light sensor set up? Voltage divider?

To save you some time in your coding i will tell you that

if((up == HIGH) && (old_up == LOW))

is the same as

if(up && !old_up)

19  Using Arduino / Displays / Re: U8Glib and analog inputs. on: October 04, 2012, 08:13:35 pm
Works like a champ. Thanks very much.
20  Using Arduino / Displays / Re: U8Glib and analog inputs. on: October 03, 2012, 11:46:25 pm
Thanks very much. I tried something similar earlier when testing but it was a little different than your implementation.

I attempted to do the picture loop itself when the menu was updated. Made it go somewhat goofy. I will try your method and report back.

21  Using Arduino / Displays / Re: U8Glib and analog inputs. on: October 03, 2012, 10:35:06 pm
There is a lot of code there.

here are some pieces that illustrate generally what i have going on.....

Full code attached if needed.

void menuSelection(){

  // depending on what menu is displayed do the proper function for the button press

  if (menuNumber == 4 && millis() - lastButtonPress > debounce){
    if (!screenButton4) {
      menuNumber = 3;
      buttonStates = false;
      masterInputs = false;
      slaveOutputs = false;
      lastButtonPress = millis();

void getInputs(){

  azimuthMaster = analogRead(azimuthPin); // read analog values from master arm
  shoulderMaster = analogRead(shoulderPin);
  elbowMaster = analogRead(elbowPin);
  pitchMaster = analogRead(pitchPin);
  wristMaster = analogRead(wristPin);
  jawClose = analogRead(jawClosePin);
  jawOpen = analogRead(jawOpenPin);
  freeze = analogRead(freezePin);

  screenButton1 = digitalRead(screenButton1Pin); // set variables to state of pins
  screenButton2 = digitalRead(screenButton2Pin);
  screenButton3 = digitalRead(screenButton3Pin);
  screenButton4 = digitalRead(screenButton4Pin);
  screenButton5 = digitalRead(screenButton5Pin);
  screenButton6 = digitalRead(screenButton6Pin);
  screenButton7 = digitalRead(screenButton7Pin);
  screenButton8 = digitalRead(screenButton8Pin);

  upButton = digitalRead(upButtonPin);
  downButton = digitalRead(downButtonPin);
  leftButton = digitalRead(leftButtonPin);
  rightButton = digitalRead(rightButtonPin);

  if (screenButton1 || screenButton2 || screenButton3 || screenButton4 || screenButton5 || screenButton6 || screenButton7 || screenButton8 || upButton || downButton || leftButton || rightButton){
    anyButtonPressed = true; // if any face button is pressed make this true

  else {
    anyButtonPressed = false; // else no buttons are pressed

void Menu(){

  switch (menuNumber){
  case 4: // page to display diag sub pages (analog in, servo out, button state)
    //left aligned position (leftSideOfScreen, vertical position, string  )
    u8g.drawStr( 0, 20, "");
    u8g.drawStr( 0, 55, "");
    u8g.drawStr( 0, 90, "");
    u8g.drawStr( 0, 125, "<- Diag");

    //right aligned position (screenWidth-WidthOfString), vertical position, string)
    u8g.drawStr(screenWidth-(u8g.getStrWidth("")), 20, "");
    u8g.drawStr(screenWidth-(u8g.getStrWidth("")), 55, "");
    u8g.drawStr(screenWidth-(u8g.getStrWidth("")), 90, "");
    u8g.drawStr(screenWidth-(u8g.getStrWidth("")), 125, "");

void Diag(){
  if (masterInputs){ // display raw inputs from master controller
    u8g.drawStr(screenWidth/2-(u8g.getStrWidth("Master Inputs"))/2, 12 ,"Master Inputs");
    u8g.drawFrame((screenWidth/2-(u8g.getStrWidth("Master Inputs"))/2)-2, 0, u8g.getStrWidth("Master Inputs")+4, 14);
    /* Display the name of the function aligned just left of center
     then display the value 3 pixels right of the colon */
    u8g.drawStr((screenWidth/2-(u8g.getStrWidth("Azimuth:"))+15),28,"Azimuth:"); // set label and align
    u8g.setPrintPos(screenWidth/2+18,28); // set location of value print
    u8g.print(azimuthMaster); // value to print
    u8g.drawStr((screenWidth/2-(u8g.getStrWidth("Jaw Close:"))+15),103,"Jaw Close:");
    u8g.drawStr((screenWidth/2-(u8g.getStrWidth("Jaw Open:"))+15),118,"Jaw Open:");

void draw(void) {

void loop(void) {

    // picture loop
    do {
    // Serial.println("drawing");
    while( u8g.nextPage() );
22  Using Arduino / Displays / U8Glib and analog inputs. on: October 03, 2012, 09:15:15 pm

I have some pots connects to my mega. I also have u8Glib running my LC7981 driven display.

If i comment out the code for the display updates my analog ins run nice and smooth and sample great....

If i leave int he do{} while for the picture loop it drop me down to around 1 analog update every other second.

Is this just how long it takes to update the display or is there something i can do to get my analog in's sampling more quickly while not sacrificing too much on the display?

Thanks all.
23  Using Arduino / Motors, Mechanics, and Power / Re: Ok. so Another noob question... on: September 18, 2012, 09:37:53 pm
Might need some more info. Want the motor to just go one direction and you control speed or you looking to have it be bi-directional?

If one direction see what you can do with this line

// map the speed controller output from the 10 bit input to a pwm output of 8 bits
speedOut = map(analogRead(A0), 0, 1023, 0, 255);
24  Community / Bar Sport / Re: L.E.D. Zeppelin on: September 17, 2012, 09:22:14 am
A co-worker of mine said this is the real Electric Funk
25  Using Arduino / Displays / Re: LCD Backlight Inverter on: September 16, 2012, 10:49:10 pm
Thanks for you comments.

I really don't have a data sheet for the LCD itself. I know it was made by Densitron due to a sticker on it but beyond that there were no identifying markings. I managed to get it running by identifying the controller chip and a lot of ohming traces.

I will be using this in potentially unknown lighting condition and the LCD will be remaining in it's original case. The rest of the case has been re-purposed but the screen is form fit to the top of the case and the mounting screws all line up... that's really the only reason i care for this specific display.

Essentially what i will be doing is taking an old control station from work and making it into a smaller form version of the same thing. kind of a "display" model if you will. I can't do that with the OEM boards but i would really like the general interface to be the same and that's one of the main reasons i was looking to keep the original screen instead of getting a known value of an off the shelf model.
26  Using Arduino / Programming Questions / Re: JavaScript -> ? -> arduino on: September 16, 2012, 02:35:18 pm

@goffballtech - What the Arduino uses C/C++ does not matter at all!.


It matters very much if the OP's question was aimed at using
JavaScript (ajax) to control the mega which will generate PWM.

Javascript will not "control" the mega. Javascript will send a set of data that will be received by the mega and interpreted to produce the proper command. These are very different things. This is what the remaining portion of my reply was addressing.
27  Using Arduino / Programming Questions / Re: JavaScript -> ? -> arduino on: September 16, 2012, 02:22:58 pm
Arduino is built on c++. No javascript that i know of.

How do you plan to get the data from your router to the arduino? Perhaps UDP or TCP and a networking shield?

You can have the javascript output a packet\ that contains the information you need then have the arduino recieve that packet and use it to control whatever needs the PWM signal.
28  Using Arduino / General Electronics / Re: Relay or Mosfet as switch. on: September 16, 2012, 02:17:03 pm
Why not just get a diode isolator and let one alternator charge both batteries?
29  Using Arduino / Networking, Protocols, and Devices / Re: 2 servers 1 ip little help. on: September 16, 2012, 01:02:04 pm
not sure what any of this has to do with Arduino really....

a DMZ essentially pushes all external ports to that one PC thinking that is the computer that will handle all external access items.

Remove the DMZ and port forward individually to the appropriate computer for what you are trying to access and i think you'll be fine.
30  Using Arduino / Sensors / Re: One wire bus problum on: September 15, 2012, 07:10:37 pm
or you could post a link and save someone who is potentially going to attempt to give you assistance from searching for the proper thread.
Pages: 1 [2] 3 4 ... 12