Show Posts
Pages: 1 ... 39 40 [41] 42 43 ... 252
601  Using Arduino / Programming Questions / Re: need help in my programe . on: June 16, 2014, 12:45:55 pm
The analogRead returns a value between 0 and 1023 when reading the pot. When your joystick is centered, the value is usually 512, however this in never always true, sometimes it is above 512 or below, so DZ helps o give you more slack.

You want the motors to go forward and reverse, and what I have done is split the joystick value into two variables, DRV1 and DRV2. DRV1 handles forward movement, and DRV2 is reverse. There are also IF statements that monitor the variable z to see whether the car should be going forward or reverse based on the value. This function also handles skid steering, (constrain(abs(DRV1 - STRL),0,255) ) so Forward and Left gets calculated and the car moves forward and to the left. Same for reverse.

Why use 2 motor drivers if one should be enough, just wire both motors (on the same side) to the same pins. Also I didn't see an external battery in the picture, so are you powering the motor drivers from the Arduino directly or from a battery pack?
602  Using Arduino / Programming Questions / Re: need help in my programe . on: June 16, 2014, 12:18:33 pm
It was an example function, not full code.

To use the function, it should be like this.
void setup()
  /* pinModes */

void loop()
  move(analogRead(analoginpin1), analogRead(analoginpin2), 6); // 6 is the deadzone, so you can have some slack when your joystick returns to center.

/* You can fill in the rest */

You should also not be driving the motors directly from the arduino, you can burn it out like that, instead you should be using a motor driver, if you're not already.
603  Using Arduino / Programming Questions / Re: need help in my programe . on: June 16, 2014, 11:42:38 am
Here is an example function:
byte LMF = 3;// PWM Left motor forward pin
byte LMR = 5;// PWM Left motor Reverse pin
byte RMF = 11;// PWM Right motor forward pin
byte RMR = 6;// PWM Right motor reverse pin

/*Rest of code here*/

void move(int z, int y, int DZ)// z = analog_1, y = analog_2, DZ = dead/neutral zone factor.
  //Movement varibles
  int DRV2 = map(z, 0, 512 - DZ, 255, 0);
  int DRV1 = map(z, 512 + DZ, 1023, 0, 255);
  int STRL = map(y, 0, 512 - DZ, 255, 0);
  int STRR = map(y, 512+ DZ, 1023, 0, 255);

  if(z > 512)//forwards              
    //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 < 512)//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 == 512 && y > 512)//Right              
    //Serial.println("360 left");
    digitalWrite(LMR, LOW);
    analogWrite(RMR, STRR);  
    analogWrite(LMF, STRR);
    digitalWrite(RMF, LOW);
  else if(z == 512 && y < 512)//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);    
604  Using Arduino / Programming Questions / Re: need help in my programe . on: June 16, 2014, 11:24:14 am
if i can't user more than one pin , and i can't call function like [ auto_pikot()] ..
I asked when does the function ever get called?

the code i wrote i finished it , i but it just to understand for whom reading my topic ...
??? Can you post your finished code.
605  Using Arduino / Programming Questions / Re: need help in my programe . on: June 16, 2014, 11:04:06 am
analogWrite(here i want to put more than one pin(m1_f + m2_f) , motors_value1);
  analogWrite(m1_b , motors_value2);

You can't use more than one pin like that, you need to split them up.

  if (sen4_val==HIGH){robot_stop();
These delays are going to be an issue, because they won't let you do anything else until they are done. So if that IF statement condition is true, then you will need to wait until it is false to do anything afterward. But if your willing to wait, then you can use it, but I highly recommend you look into the Blink Without Delay example for a better "delay" solution.

One more thing, when does auto_pilot() ever get called?
606  Using Arduino / Project Guidance / Re: analog keyboard interfacing on: June 16, 2014, 10:46:59 am
You might not be able to use just the keystroke and value as one, so you might need to first send the key then the value after it and make sure you get both.

Or you could probably send a Struct composed of the key and value, then on the receiving side split them up to their appropriate places. I never tried it before, but it should work.

Are you using the Keyboard library, because I didn't know it was compatible with an Arduino Micro.
607  Using Arduino / Audio / Re: Can anyone recommend a voice recognition module? on: June 16, 2014, 10:27:26 am
How many commands are you looking to have?
I have this module, it can have 3 groups consisting of 5 words each. I would walk you through it, but the driver is not compatible with my Windows 8 laptop ( Win 7 and under).

Another is this one. Dfrobot Speech Recognition Module I'm not sure how good it is.

Finally there is the EasyVR It supports 32 words and from what I've heard it is quite easy to setup. Kinda expensive though.
608  Using Arduino / Displays / Re: Trouble compiling examples for the UTFT Library on: June 16, 2014, 08:49:32 am
UTFT.h: No such file or directory
This is big hint to consider. The compiler can't find your library, so where did you put it?
609  Using Arduino / Project Guidance / Re: analog keyboard interfacing on: June 16, 2014, 08:44:16 am
What about a racing game? Pressure sensitive keys will allow you to increase/decrease speed depending on the pressure applied to the key.

Another is maybe a pinball game. We all tend to hit the button/paddle harder in order to hit the ball harder, don't we?
610  Using Arduino / Programming Questions / Re: Question on a 2x2x2 LED cube? on: June 15, 2014, 09:37:02 pm
You can use a shift register, they only need three pins, clock, data and latch.

Another option is charlieplexing.
611  Using Arduino / Programming Questions / Re: Need some help on: June 15, 2014, 07:32:35 pm
He should be using the Blink Without Delay method and he should also have a flag that lets the code know when the LED is on and off.  This way it cuts down the processing time.

612  Development / Other Software Development / Re: performance of map() function - an analysis on: June 15, 2014, 04:51:47 pm
Couldn't you just use a template? This way instead of having multiple functions, you just have one that changes its type.
613  Development / Other Software Development / Re: New TFT Extension Library on: June 15, 2014, 11:29:40 am
Sorry about that.

As for the version, there is most likely going to be one more coming out and that's the new keyboard layouts (iOS and Android style) and maybe a clock face, maybe.

Other than that, I think i'm finally done.

But I'll add the version in.

Below is just the .cpp file, you can replace the one you have with this one.
614  Development / Other Software Development / Re: New TFT Extension Library on: June 14, 2014, 11:39:29 pm
Slight update:
I fixed some things in the Smiley face function and got rid of the extra pixel at 0 deg.

And put the keyboard characters in the PROGMEM

615  Using Arduino / Programming Questions / Re: Still having trouble with the time on: June 14, 2014, 11:38:20 am
Ok, that works, this way if its a single digit, it gets printed as 11:05:09 instead of 11:5:9
Pages: 1 ... 39 40 [41] 42 43 ... 252