Show Posts
Pages: 1 ... 48 49 [50] 51 52 ... 196
736  Using Arduino / Programming Questions / Re: Traffic Light Controller Programming Code on: December 06, 2013, 03:58:49 pm
Get rid of all the delays functions, and look at the example sketch Blink without Delay. It will help you tremendously.
737  Using Arduino / Programming Questions / Re: Ultrasonic sensor mounted on a servo on: December 06, 2013, 03:56:58 pm
Try this, instead of using the using || use &&, this way the code knows to compare the ranges from Left AND Right, as opposed to Left OR Right.

See if that works, if not it could be another issue somewhere else.
738  Using Arduino / Programming Questions / Re: byte mirror code don't work on: December 06, 2013, 03:12:22 pm
Thanks
739  Using Arduino / Programming Questions / Re: byte mirror code don't work on: December 06, 2013, 03:03:59 pm
If it helps any, here is my solution.
Code:
byte Mirror(byte ary)
{
  byte h, l;
  byte table[16] = {
    0x0, 0x8, 0x4, 0xC,
    0x2, 0xA, 0x6, 0xE,
    0x1, 0x9, 0x5, 0xD,
    0x3, 0xB, 0x7, 0xF
  };
  h = table[ (ary & 0xf0) >> 4 ]; // Notice the closing bracket is different from the one below. This is because of the look up table is written as 0xN and not 0x0N
  l = table[ ary & 0x0f ] << 4;
  //Serial.println( l | h ,HEX);
  return (l | h );
}
740  Using Arduino / Project Guidance / Re: Arduino Robot Arm controlled by Joystick on: December 06, 2013, 01:30:57 pm
???
How else would you go about connecting the joystick to the servos? You can use a breadboard, unless you want to make your own PCB.

The codes ZoomKat provided work like this. If you press a button, the servo will move to a certain position, press another button and it will move to a different position.
741  Using Arduino / Project Guidance / Re: Arduino Robot Arm controlled by Joystick on: December 06, 2013, 01:02:20 pm
No don't use a Y-cable for any of the servos, that will not work the way you want it to.  Simply connect all five of the servos data pins to the Arduino's digital pins (2 - 6). The wires are usually color coded. Yellow or blue is usually the data pin, and red/ black or red/ brown are for the power. Red being positive.
742  Using Arduino / Project Guidance / Re: Arduino Robot Arm controlled by Joystick on: December 06, 2013, 12:47:41 pm
@ZoomKat:

He will be using the joystick to control the servos, not the buttons. The buttons will determine which servos will move. Do you have any sample codes along those lines?
743  Using Arduino / Project Guidance / Re: Arduino UNO not receiving serial data(TX) from Bluetooth module on: December 06, 2013, 12:41:37 pm
Have you tried it with Putty or any other terminal program other than the serial monitor? What program are you using on your phone?
744  Using Arduino / Project Guidance / Re: Arduino Robot Arm controlled by Joystick on: December 06, 2013, 12:29:20 pm
The servos will only give you about 5-6 inches of slack, so as in the video, you will need to make a lengthy cable of 5 or more wires. This will connect the joystick to the Arduino. As for the servos, you will need to have a power supply that can provide 6 volts! This will be enough to power the Arduino and the servos. Mainly the servos because they need 6 volts to work properly. Now if you use two different power supplies, you need to make sure the grounds are connected. (Look that up if needed)

That should be enough to give you some idea to start with.
745  Using Arduino / Project Guidance / Re: Arduino Robot Arm controlled by Joystick on: December 06, 2013, 12:03:29 pm
I got one better. It may seem a little over the top for you, but it is actually very simple.
Keep the one joystick, but in addition, use an accelerometer to control the Base and Arm. This way, the controls should be more fluid and the joystick will only be in charge of two functions instead of all three.
746  Using Arduino / Project Guidance / Re: Using multiple push-buttons on: December 06, 2013, 06:12:19 am
Your schematic is correct, and no you don't need to ground them, the library takes care of everything. Wire it the way it is in your picture, and it should work fine.
747  Using Arduino / Project Guidance / Re: Arduino UNO not receiving serial data(TX) from Bluetooth module on: December 06, 2013, 02:18:45 am
Test it with the serial monitor, make sure you change all the number 13 to 2.
748  Using Arduino / Project Guidance / Re: Arduino Robot Arm controlled by Joystick on: December 05, 2013, 06:35:41 pm
Example: You can fill in the rest.

Code:
X = analogRead(A0);
Y = analogRead(A1);
B1 = analogRead(A2); // can be done also with digitalRead too, but I was just copying and pasting.
B2 = analogRead(A3); //-------------------------------------------------------------------------

if( B1 == HIGH ) // button 1 is being held down.
{
  // move elbow servo based on Y axis +/-
}

else if( B2 == HIGH )
{
  // Open and Close claw servo based on Y axis +/-
  // Move wrist servo based on X axis +/-
}

else
{
  // rotate base or shoulder (Left / Right) based on X axis +/-
  // Raise / Lower shoulder (Up / Down) based on Y axis +/-
}
749  Using Arduino / Project Guidance / Re: Arduino Robot Arm controlled by Joystick on: December 05, 2013, 06:09:00 pm
The code will work exactly how krazydarcy described it.

Get reading from joystick and two buttons.
If button_One is held down, and joystick moves, do action 1.
else if button_two is held down, and joystick moves, do action 2.
else do action 3.
750  Using Arduino / Project Guidance / Re: Arduino UNO not receiving serial data(TX) from Bluetooth module on: December 05, 2013, 06:03:41 pm
Try this, this is as simple as it gets. If the phone sends anything at all, the LED should go on.

Code:
void setup()
{
  pinMode(13, OUTPUT);  // pin 13 (on-board LED) as OUTPUT
  Serial.begin(9600);       // start serial communication at 115200bps
}

void loop()
{
  if( Serial.available() > 0)       // if data is available to read
  {
     digitalWrite(13, HIGH);
  }

  else
  {
    digitalWrite(13, LOW);
  }
}
Pages: 1 ... 48 49 [50] 51 52 ... 196