Show Posts
Pages: 1 ... 21 22 [23] 24 25 ... 232
331  Using Arduino / Programming Questions / Re: If else statement for two pots and two LED's on: June 07, 2014, 11:15:37 pm
Quote
One other thing, when using the Serial monitor, you should not be using pins 0 or 1,
const int LED1 = 1;
332  Using Arduino / Programming Questions / Re: If else statement for two pots and two LED's on: June 07, 2014, 10:58:45 pm
Declare your variables, don't make them all CAPS and don't make them const, otherwise you wont be able to change them.
int analogValue1;
int analogValue2 ;

Now in your loop, you want to read from the analog pins.
void loop
{
  analogValue1 = analogRead(analogPin1); // these should not be CAPS either
  analogValue2 = analogRead(analogPin2);
.
.
.
}

One other thing, when using the Serial monitor, you should not be using pins 0 or 1,
const int LED1 = 1;
333  Using Arduino / Project Guidance / Re: I finally tested the accuracy of delay() for 24 hours. on: June 07, 2014, 08:09:35 pm
Thats great, but no one uses delays. An experienced programmer will tell you to never use delays throughout your code, but to instead use the millis() or micros() function to keep track of time.

Edit: Good find.
334  Development / Other Software Development / Re: New TFT Extension Library on: June 07, 2014, 02:59:12 pm
UPDATE!

Library is below.
335  Using Arduino / Programming Questions / Re: Help me in pressure sensor read from 0 - 10Vdc 0-250 bar on: June 07, 2014, 12:01:36 pm
The pressure sensor needs 10v? What does it output then, I'm assuming more than 5v. If 125 Kpa is the max then with a little math 125/5 = 25, so why are you multiplying "volt" by 31.3, and not 25?
336  Using Arduino / Programming Questions / Re: Help me in pressure sensor read from 0 - 10Vdc 0-250 bar on: June 07, 2014, 11:29:02 am
Did you make the voltage divider circuit and does it work now?
337  Using Arduino / Project Guidance / Re: Mecanum Wheels on: June 06, 2014, 01:24:49 pm
This is the camera I am using Mini Wireless Security Camera with this mount Arduino Servo Mount
338  Using Arduino / Project Guidance / Re: Mecanum Wheels on: June 06, 2014, 12:57:10 pm
Wireless video stream.

The code snippet I gave is basically your Mode 1.
Mode 2 is a bit different, to strafe left and right, the wheels need to rotate opposite of each other.

Like so, F = forward, R = reverse
Left:   Right:
F        R   : (front wheels)
R        F   : (rear wheels)
339  Using Arduino / Displays / Re: Help Arduino Mega 2560 + 3.2" TFT LCD on: June 06, 2014, 11:39:35 am
Your using the UTFT and UTouch libraries, you should be able to run the calibration sketch. Attached is the calibration sketch, You may need to change a few lines to get it to work, like you pin numbers and model.
340  Using Arduino / Project Guidance / Re: Mecanum Wheels on: June 06, 2014, 10:39:39 am
This is my truck. http://youtu.be/aOkvHuVhnMA which original started from this (code wise) http://youtu.be/86x_E6Ngpmc
341  Using Arduino / Project Guidance / Re: Mecanum Wheels on: June 06, 2014, 09:59:10 am
Quote
I am only using 2 axis joystick. for example parallax 2 axis joystick hardwired to arduino mega on two analog inputs.
You want to hardwire the joystick to the same arduino, or make it wireless?

Either way you would need to convert the 0-1023 range from the joysticks to values for your motors. I used the map() function and a few IF/ELSE statements for my RC truck.

Here is my drive code(not the full code). My controller outputs 0 - 20 for both Forward/Reverse and Left/Right, then from those values, drive the motors accordingly.
Code:
void move(int z, int y, int s)

  //Movement varibles
  int DRV2 = map(z, 0, 10, 255, 0); //Reverse
  int DRV1 = map(z, 10, 20, 0, 255); // Forward
  int STRL = map(y, 0, 10, 255, 0); // Left
  int STRR = map(y, 10, 20, 0, 255);// Right

  if(z > 10)//forwards, Center point is 10, so if z is greater than 10, go forward, else reverse.           
  {
    //Serial.println("Forward with turning");
    analogWrite(LMF, constrain(abs(DRV1 - STRL),0,255));
    analogWrite(RMF, constrain(abs(DRV1 - STRR),0,255));   
    digitalWrite(LMR, LOW);
    digitalWrite(RMR, LOW);   
  }
  else if(z < 10)//backwards               
  {
    //Serial.println("Reverse with turning");
    digitalWrite(LMF, LOW);
    digitalWrite(RMF, LOW);   
    analogWrite(LMR, constrain(abs(DRV2 - STRL),0,255));
    analogWrite(RMR, constrain(abs(DRV2 - STRR),0,255));   
  }
  else if(z == 10 && y > 10)//Right               
  {
    //Serial.println("360 left");
    digitalWrite(LMR, LOW);
    analogWrite(RMR, STRR);   
    analogWrite(LMF, STRR);
    digitalWrite(RMF, LOW);
  }
  else if(z == 10 && y < 10)//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);   
  }
  y=0; z=0; s=0;
}

Have you tested your motors with some simple code? Forward, reverse, left, right ?
342  Using Arduino / Project Guidance / Re: Mecanum Wheels on: June 06, 2014, 09:30:39 am
Good, now how do you plan on controlling it, what have you decided on? Both Xbox and Ps3 controllers will need the USB host shield and Bluetooth dongles to work. Or you can go with either paired bluetooth modules or RF modules. The "modules" are easier to learn and use, but are not compatible with a xbox or Ps3 controllers. The downside of these module is you would need a second arduino to act as a controller.

Quote
Two kangaroo motor controllers
Kangaroo makes motor controllers? Never mind

Alternative:
If you want, you can use a wireless Ps2 controller, which would give you the same range as a Ps3 or Xbox, and you won't need to buy a USB host shield or a second arduino. Also they are VERY cheap now, gamestop probably has them for $5 on the clearance rack.
343  Using Arduino / Project Guidance / Re: Mecanum Wheels on: June 06, 2014, 09:18:47 am
It actually easier than you think, especially with the numerous topics on skid steering and single joysticks. However, because you want to strafe left and right, this would mean you need two motor driver controllers. one for the front wheels and the other for the back wheels.

What parts do you have already?
344  Development / Other Software Development / Re: New TFT Extension Library on: June 05, 2014, 04:01:09 pm
Notice:
I have a few new functions coming out soon. One is already done and its called TouchCircleByQuad
Basically it will return the quadrant of which you touched, (1,2,3 and 4) or you can specify a specific quadrant(s) and it will return true if it/they are touched.

The other two are Swipe and SwipeFromArea.
Swipe: Will return a value based on the direction you swiped on the screen from your initial touch(anywhere on screen). 1 = up, 2 = down, 3 = left and 4 = right. I am still fine tuning this function but it's not 100% yet.

SwipeFromArea: Needs an area to swipe from and a direction(x1, y1, x2, y2). This function will allow you to do things like, do something when only the bottom left side of the screen is swiped to the right or you can add multiple functions to do different things. Not 100% yet either.

I am also thinking of adding double tap buttons, but I don't know if they are really needed. But if someone wants them, I will add them.
345  Using Arduino / Displays / Re: Help Arduino Mega 2560 + 3.2" TFT LCD on: June 05, 2014, 01:56:37 pm
If you run the calibration sketch, it will give you values at the end, to replace the CAL_X/Y and S, thus fixing your problem.
Pages: 1 ... 21 22 [23] 24 25 ... 232