Show Posts
Pages: 1 2 3 [4] 5 6 ... 243
46  Using Arduino / Programming Questions / Re: External power supply for servos using 7805 on: August 25, 2014, 04:25:58 pm
1017 is a value based on a range of 0 - 1023 or ~0 - 5V.
To see the voltage from the pin, you need to multiply the value you get from the analogRead() by 0.00488759.

Code:
float V = float(analogRead(A0));

float V_final = V * 0.00488759;

Serial.println( V_final );

If you feed 5.7V into the analog pin, you will fry the Arduino Use a voltmeter!

47  Using Arduino / Programming Questions / Re: External power supply for servos using 7805 on: August 25, 2014, 12:52:53 pm
I have those exact servos, and though they are rate for 4.8 - 6.0V, they don't do so good at 5.0V. I am running them at 5.7V using a 7805 and a diode. Look at this for schematic LINK
48  Using Arduino / Programming Questions / Re: External power supply for servos using 7805 on: August 25, 2014, 10:47:06 am
That battery is probably not supping enough current. If you had 2 in parallel, it might work or you can just power the servo with 4xAA batteries without the regulator.

It could also be an issue with the code too, please post it.
49  Using Arduino / Project Guidance / Re: Need Help on creating a code for my Tank Project. on: August 25, 2014, 09:10:12 am
Here is another one that can be useful. I edited my current code a bit.

Single Joystick  (minor edit to flip conditions)
Code:

const byte LMF = 3;// PWM Left motor forward pin
const byte LMR = 5;// PWM Left motor Reverse pin
const byte RMF = 11;// PWM Right motor forward pin
const byte RMR = 6;// PWM Right motor reverse pin

void setup()
{
  //Serial.begin(115200);
  pinMode(LMF, OUTPUT);                               
  pinMode(RMF, OUTPUT);
  pinMode(LMR, OUTPUT);                               
  pinMode(RMR, OUTPUT);
}

void loop()
{
  move(analogRead(A0), analogRead(A1), 5, 5, false, false);
}

void move(int FR, int T, int FRdead, int Tdead, boolean FRflip, boolean Tflip)
{
  int DRV1,DRV2,STRL,STRR;
 
  if(FRflip) // if the joystick is upside-down, user can flip it
    FR = 1023 - FR; // FR -= 1023 will not work

  if(Tflip) //if the joystick is left instead of right, user can flip it
    T = 1023 - T;

  if(T > (511 + Tdead))      // T > 511
    STRL = (511 - T)/2;      // ((511 + Tdead) - T)/2;
  else if(T < (511 - Tdead)) // ...
    STRR = (T - 511)/2;      // ...

  if(FR > (511 + FRdead))
    DRV1 = (511 - FR)/2;
  else if(FR < (511 - FRdead))
    DRV2 = (FR - 511)/2;

  if(FR > (511 + FRdead))//forwards               
  {
    //Serial.println("Forward with turning");
    analogWrite(LMF, constrain(abs(DRV1 - STRL),0,255)); // Get the difference of forward and turning, make sure not to overflow.
    analogWrite(RMF, constrain(abs(DRV1 - STRR),0,255));   
    digitalWrite(LMR, LOW); // can be cut out if motor wires are pulled low
    digitalWrite(RMR, LOW); // can be cut out if motor wires are pulled low
  }
  else if(FR < (511 - FRdead))//backwards               
  {
    //Serial.println("Reverse with turning");
    digitalWrite(LMF, LOW);// can be cut out if motor wires are pulled low
    digitalWrite(RMF, LOW);// can be cut out if motor wires are pulled low   
    analogWrite(LMR, constrain(abs(DRV2 - STRL),0,255));
    analogWrite(RMR, constrain(abs(DRV2 - STRR),0,255));   
  }
  else if((FR < (511 + FRdead) && FR > (511 - FRdead)) && T > (511 + Tdead))//Right               
  {
    //Serial.println("360 left");
    digitalWrite(LMR, LOW);
    analogWrite(RMR, STRR);   
    analogWrite(LMF, STRR);
    digitalWrite(RMF, LOW);
  }
  else if((FR < (511 + FRdead) && FR > (511 - FRdead)) && T < (511 - Tdead))//Left             
  {
    //Serial.println("360 right");
    analogWrite(LMR, STRL);
    digitalWrite(RMR, LOW);   
    digitalWrite(LMF, LOW);
    analogWrite(RMF, STRL);   
  }

  else //full stop
  {
    digitalWrite(LMF, LOW);
    digitalWrite(RMF, LOW);       
    digitalWrite(LMR, LOW);
    digitalWrite(RMR, LOW);   
  }
}

Keep in mind, speed increments may be choppy.
50  Using Arduino / Project Guidance / Re: Need Help on creating a code for my Tank Project. on: August 25, 2014, 07:47:46 am
@Cr0sh

Yes the concept is correct in the link you provided, but if you look closely, that code only make the motors spin in one direction. Unless your using a driver that can change direction based off of (1 = forward, 0 = reverse) + speed, then that code wont work.
51  Using Arduino / Project Guidance / Re: Need Help on creating a code for my Tank Project. on: August 24, 2014, 09:33:20 pm
1) http://forum.arduino.cc/index.php?topic=247370.0
2) http://forum.arduino.cc/index.php?topic=211614.0
3) http://forum.arduino.cc/index.php?topic=161927.0

Just did a quick search for Skid Steering and just picked three of the ones I helped with.
Try doing a search for Differential Steering, you will find many more.
52  Using Arduino / Project Guidance / Re: Need Help on creating a code for my Tank Project. on: August 24, 2014, 06:29:21 pm
Differential steering with a single joystick is extremely simple, and there are countless examples on the forum that show just that.

I myself have a working code that I use on my RC truck, that I modified to work with a Wii classic controller and PS2 controller, both duel and single stick.
53  Development / Other Software Development / Re: New peek function for HardwareSerial on: August 24, 2014, 10:50:49 am
If your reffering to the post where PaulS was taking about the delay I put in the code and proper delimiters, the new code doesn't need any of them. The peek function that I modified looks at everything in the Rx buffer. The buffer is never actually cleared like I thought it was, instead the tail value is decremented with each call of read() giving the appearance of it being cleared. All in all the buffer just rolls over once it collects more than 64 bytes.
54  Using Arduino / Programming Questions / Re: Problem with SoftwareSerial on: August 24, 2014, 10:36:34 am
So choose two pins other than one that are already set a UART ports. Most common are pins 2 and 3
55  Development / Other Software Development / Re: New peek function for HardwareSerial on: August 24, 2014, 01:16:59 am
Yea... it didn't quite work like expected. making the head = tail (or vs) only makes Serial.available = false. I was looking for a better way to clean out the buffer without using a while/for loop. The peek function I added, worked like a charm, so I was happy with that.

56  Using Arduino / Programming Questions / Re: Problem with SoftwareSerial on: August 24, 2014, 12:56:37 am
1) Wrong place to put this, it should be in Programming Questions
2) Code tags!
3) Why are you trying to use Software Serial on a board that has 4 UART ports? Why not just use Serial1, Serial2 or Serial3.begin(...)?

4) Unless you plan on using a bluetooth module or some other form of Serial connection, the Serial monitor is only set to use Serial.begin(...), and as far to my knowledge, it can't be changed.
57  Using Arduino / Programming Questions / Re: Mega2560 + 3.2 TFT Touch, automated terrarium control + manual buttons on: August 23, 2014, 08:33:37 pm
If the buttons are giving you issues, you can try my library, it works with UTFT and UTouch. Do a search for TFT_Extension in either the forum or arduino playground. I included plenty of examples. Give it a try.
58  Using Arduino / Project Guidance / Re: Arduino Uno + WiFi Shield + TFT LCD Screen on: August 23, 2014, 07:42:28 pm
Post a link to your TFT screen an wifi module
59  Using Arduino / Project Guidance / Re: Arduino Uno + WiFi Shield + TFT LCD Screen on: August 23, 2014, 06:57:12 pm
That might be the case, they might be using some of the same pins.
60  Using Arduino / Programming Questions / Re: airsoft bomb on: August 22, 2014, 08:26:37 am
BombPro, is the main file, and everything else are subscripts.

To see them all as one file, you need to add the folder Bombpro to your sketch book and open the file "bombpro". You should see everything in one window as tabs.
Pages: 1 2 3 [4] 5 6 ... 243