Show Posts
Pages: 1 ... 91 92 [93] 94 95 ... 196
1381  Using Arduino / Programming Questions / Re: maximum delay in arduino an how to make it on: May 20, 2013, 11:33:47 am
simple way: Delay(1000) is equal to 1 second, so 60 * 1000 = 1 minute.

you can do this,
for(count = 0; count < 60 ; count++)
{
  delay(1000);
}

Or you can look into the blink without delay example, and follow it like a religion.
1382  Using Arduino / Programming Questions / Re: Linear Interpolation and Mapping on: May 20, 2013, 10:56:56 am
Question, what is it supposed to look like and why is finalValue = 300; within the loop?

Does percentage give you the correct values?
Adding comments helps too.
1383  Using Arduino / Programming Questions / Re: MOVING A SERVO INTO THREE POSITIONS USING ONE BUTTON on: May 20, 2013, 09:09:01 am
Let me guess, you press the button once and its going through all three positions.

You may want to keep track of the last button state, and compare it to the current button state. If the current button state is high and the current button state does NOT equal the last button state, directionState++. (directionState > 2, reset back to zero)

Quote
if (buttonState == HIGH) {
      directionState = 0;   
      {
        myservo.write(0); 
         delay(15);
      }
     }
   }}}
//this is unacceptable, use the format tool (Ctrl + T)
1384  Using Arduino / Programming Questions / Re: VirtualWire receiver never gets its message on: May 20, 2013, 08:37:46 am
digitalWrite(latchPin, HIGH); ?
I was under the impression that you were using the code you posted above. What code are you using now?
1385  Using Arduino / Programming Questions / Re: VirtualWire receiver never gets its message on: May 20, 2013, 06:56:16 am
Just a heads up, you cant use any PWM on pins 9 or 10, because the virtualwire library uses that timer. If you have anything on 9 or 10 it will give you weird results.
1386  Using Arduino / Project Guidance / Re: Could some double check my layout? on: May 18, 2013, 03:20:37 pm
Iv got a cut in the track between the diode (d1) and the ground jumper over on the top right.....or am I missing another short?

Oh ok, I could barely see that.
1387  Using Arduino / Project Guidance / Re: Could some double check my layout? on: May 18, 2013, 03:11:05 pm
You have a short on the Vin and GND on the right side. Vin needs to be moved one pin down.
1388  Using Arduino / Displays / Re: i need some help in g lcd with a keypad 4x4 on: May 17, 2013, 10:55:21 pm
Post your code
1389  Using Arduino / Programming Questions / Re: Keypad User Interface on: May 17, 2013, 07:17:27 pm
Your looking for chars, so
if ( key == 1)
 
should be

if ( key == '1')
OR, you can do
 
if((key - 48) == 1 )...

1390  Using Arduino / Programming Questions / Re: Help me make sense of these bits - part 2 on: May 17, 2013, 07:05:24 pm
0000   at 17 ^ 0 = 00010000(10 HEX) + 1 = 17 dec
0001   at 18 ^ 0 = 00010001(11 HEX) + 1 = 18 dec
0011   at 19 ^ 1 = 00010010(12 HEX) + 1 = 19 dec
0010   at 20 ^ 1 = 
0110   at 21 ^ 2
0111   at 22 ^ 2
0101   at 23 ^ 3
0100   at 24 ^ 3
1100   at 25 ^ 4
1101   at 26 ^ 4
1001   at 27 ^ 3
1000   at 28 ^ 3
There must be a better way to get this part.
1010   at 29 ^ 6
1011   at 30 ^ 6 = 00011101(29 HEX) + 1 = 30
1391  Using Arduino / Programming Questions / Re: Help me make sense of these bits - part 2 on: May 17, 2013, 03:27:15 pm
Damn, I thought I had the pattern.
gotten    want  mask actual
0000   at 17 ^ 0 = 00010001(17 HEX)
0001   at 18 ^ 0 = 00010010(18 HEX)
0011   at 19 ^ 1 = 00010011(19 HEX)
0010   at 20 ^ 1
0110   at 21 ^ 2
0111   at 22 ^ 2
0101   at 23 ^ 3
0100   at 24 ^ 3
1100   at 25 ^ 4
1101   at 26 ^ 4
1001   at 27 ^ 3
1000   at 28 ^ 3
these here are what mess it up, it should be ^ 5
1010   at 29 ^ 6
1011   at 30 ^ 6
1392  Using Arduino / Project Guidance / Re: Robot help please on: May 17, 2013, 11:39:50 am
I dont see anything in your combined code that looks like what you have in motortest.

Ok, you have a way to read the joysticks, good. Does it work? Do you see the values change when you move the stick?
If it does then you will need some IF/ELSE statements or some CASE statements to tell your motors what to do.

Pseudo code.
Code:
if(joystick_y1 < 10 && joystick_y1 > -10) // values within a set range
  {
    if(joystick_y1 > 0) //see if the value it greater or less than 0.
     {
      .
      .  // move motor1 forward. You can get creative with speeds here too.
      .
     }
    else // move motor1 backward
}
Repeat for motor2
Use
AF_DCMotor motor1(4);// Left motor
AF_DCMotor motor2(6);// Right motor
1393  Using Arduino / Programming Questions / Re: toggle led on: May 17, 2013, 11:25:49 am
Quote
You're not "making the pin an output" in this line of code. You're setting the bit in PORTX to either 1 or 0. Its a memory location (I think. It's memory mapped I/O, right?), so you can read it back.

Ok, That makes more sense.
1394  Using Arduino / Programming Questions / Re: toggle led on: May 17, 2013, 10:52:28 am
@Arrch
Quote
digitalWrite(ledPin, !digitalRead(ledPin));
How does this work if the ledPin is set as an output? You make the pin an output, to set the LED on/off and then(in that same line) your going to read the pin's state without changing its mode? How does that work.

If this is true, then why bother needing pinMode, if digitalWrite sets the pin as an output and digitalRead makes it an input.

1395  Using Arduino / Project Guidance / Re: Robot help please on: May 17, 2013, 10:36:15 am
Just combine the two loop() functions into a single loop() , and same for setup(), everything else can go at the bottom.

Added. I tried your links for your USB shield and motortest, and the USB zip is not accessible(It might just be because im at work), and motortest is a PDE file.
Post both codes here as regular text.
Pages: 1 ... 91 92 [93] 94 95 ... 196