Loading...
  Show Posts
Pages: 1 2 [3] 4 5 ... 105
31  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
32  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.
33  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.

34  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.
35  Using Arduino / Programming Questions / Re: how can i do split string function? on: May 17, 2013, 08:37:20 am
The easiest way is to store it as a char array, and look for a terminatind character to tell the arduino to stop storing and start to split it.
Look in strtok().

Working Example:
Code:
char data[30];
char temp;
int count = 0;
//inside loop()
temp = Serial.read(); //read in string char by char "NS:212:Open:S1233." better to add a period at the end

if(temp != '.') { //keep storing data until a period is found
 data[count] = temp; // store chars in array
 count++; //update array
}
else {
  array[0] = strtok(data, ":. "); // split by ":" or "." or blank space " "
  array[1] = strtok(NULL, ":. ");
  array[2] = strtok(NULL, ":. ");
  array[3] = strtok(NULL, ":. ");
  count = 0; // reset count
}
36  Using Arduino / Programming Questions / Re: Simple question about a boolean on: May 17, 2013, 08:19:49 am
you can do something like this,

if(boolean == true && ((millis() - trigger_time) % 1000) >= 3) counter++; // if boolean is true and the difference of when it was triggered(changed state) to current time is greater or equal to 3 seconds.

Edit: first one would not work correctly, Sorry.
37  Using Arduino / Displays / Re: Some Boxes Dimmer Than Others (Arudino LCD) on: May 17, 2013, 07:14:08 am
It sounds like you have a dying LCD. One side works but the other does not, and when you first bought it, both sides worked. You might just need to get a new one.

Try to apply some pressure on the edges of the bad side, it may not be making full contact with the conducting strip.
38  Using Arduino / Project Guidance / Re: Robot help please on: May 16, 2013, 09:22:44 pm
Where is your attempt of combining the two codes? Not to sound rude, but where not going to put it together for you, you need to show us what you have tried so far.
Post your combined code and any errors your getting.
39  Using Arduino / Project Guidance / Re: Arduino UNO + RGB pixels strand + voice control on: May 13, 2013, 06:10:28 pm
Yea I do, and I figured it out after an hour of messing with it.
40  Using Arduino / Programming Questions / Re: utouch ssd1963 5 inch problem on: May 12, 2013, 02:38:25 am
This is not doing anything.
Quote
  val = (myTouch.dataAvailable() == true);            // reads the value of the potentiometer (value between 0 and 1023)
  val = map(val, 0, 479, 0, 799);

Your map looks like you guessed on the numbers, but I'm not surprised because your not printing the data to the LCD like I showed you how to do.

Go back and re-upload the code I gave you, I added more to it from the first time I posted it, and I wrote after that post, that I made changes to it.
41  Using Arduino / Project Guidance / Re: Best way to power Arduino (Without USB or AC adapter) on: May 12, 2013, 02:27:34 am
Those batteries are just as bad as regular 9v batteries, if not worse and they die even faster. The thing is, they don't supply enough current, and the only way you would be able to get more time out of them is if you double or triple them up (in parallel, not series). That's why I recommend getting a rechargeable battery pack. They put out a lot of current (great amount for the arduino) and they can be recharged about 1000 times over, before they start to weaken.

You can use the batteries in your link, but you will need to constantly recharge them every 10 - 15 minutes. But if your ok with that and it won't be too much trouble, then get them.
42  Using Arduino / Project Guidance / Re: Best way to power Arduino (Without USB or AC adapter) on: May 12, 2013, 01:29:36 am
Regular 9V batteries only last for about 30 minutes before they're dead, so an alternative would be some rechargeable. Some like these.
43  Using Arduino / Project Guidance / Re: Arduino UNO + RGB pixels strand + voice control on: May 11, 2013, 07:05:47 pm
Does anyone know how to record the voice commands? The access software is not quite clear.
44  Using Arduino / Programming Questions / Re: utouch ssd1963 5 inch problem on: May 11, 2013, 06:58:37 pm
Post your full code and I'll take a look at it.
45  Using Arduino / Programming Questions / Re: Bluetooth library on: May 11, 2013, 06:57:36 pm
Thanks for suggestions, i think i found problem. Seems trying to switch RX and TX wires together helped. Seems what my arduino transmits(TX) goest to BT module RX wire(Seems to be strange china fail.) So i got worked it. Now trying to send commands somehow, but PUTTY doesn't send any commands. But my phone program does. Trying to get working serial.read() function.

I told you in my first reply, how you need to wire it to the arduino.

Putty does send commands but unless you echo the command back, you won't see it. It's a minor flaw.
Pages: 1 2 [3] 4 5 ... 105