Show Posts
Pages: 1 ... 15 16 [17] 18 19 ... 229
241  Using Arduino / Project Guidance / Re: Need help with 4x4 Keypad Matrix on: June 16, 2014, 01:45:03 pm
Can you show us how it is wired to the arduino?
242  Using Arduino / Project Guidance / Re: Control air conditioner with wired remote on: June 16, 2014, 01:43:54 pm
You could use something like this IR Remote (Needs an arduino on the receiver side), but on the receiving side, you need to know what wires control which button functions.
243  Using Arduino / Project Guidance / Re: Control air conditioner with wired remote on: June 16, 2014, 01:30:29 pm
This might be a stretch, but you could maybe, just maybe get one that has a wireless controller.

If that is not possible then you will need to open the controller and see what connections do what. How many buttons does the controller have?
244  Using Arduino / Programming Questions / Re: need help in my programe . on: June 16, 2014, 01:27:07 pm
You already have the loop function, I gave it to you.
Quote
void loop()
{
  move(analogRead(analoginpin1), analogRead(analoginpin2), 6); // 6 is the deadzone, so you can have some slack when your joystick returns to center.
}

All you need to do now is add the pinModes in the setup() function, like how you have here, just change the variables.
Quote
void setup() {
  Serial.begin(9600);
 
pinMode(m1_f,OUTPUT);
pinMode(m1_b,OUTPUT);
pinMode(m2_f,OUTPUT);
pinMode(m2_b,OUTPUT);
pinMode(m3_f,OUTPUT);
pinMode(m3_b,OUTPUT);
pinMode(m4_f,OUTPUT);
pinMode(m4_b,OUTPUT);

}

As for this, you can probably do without the constrain, and just have ... for each.
analogWrite(LMF, abs(DRV1 - STRL) );

This takes the difference from "forward/ reverse" and "left and right" values and allows the robot to drive the way the joystick is moved. forward + left = the robot moves forward and to the left.
245  Using Arduino / Programming Questions / Re: need help in my programe . on: June 16, 2014, 12:59:15 pm
Im not writing the code for you, YOU can do that. In fact you need to understand your own mistakes in order to correct and pass that exam. If this is giving you a hard time then, you need to do some serious studying.

Check your pins again, and make sure everything is in the correct spot. My wiring is different from yours, so just double check. Have you tested the code on the robot?

Also
Quote
digitalWrite(LMR, LOW);
digitalWrite(RMR, LOW);
digitalWrite(LMF2, LOW); // Things like this will cause the code to fail.
digitalWrite(RMR2, LOW);

You are also missing your setup() function and loop(). If you can't figure out how to solve your own code and also have an exam tomorrow, you're going to fail. You need to comprehend how the arduino works and how to write/structure the code. Also testing is always a good way to see if the code works or not.
246  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?
247  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.
Code:
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.
248  Using Arduino / Programming Questions / Re: need help in my programe . on: June 16, 2014, 11:42:38 am
Here is an example function:
Code:
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);    
  }
}
249  Using Arduino / Programming Questions / Re: need help in my programe . on: June 16, 2014, 11:24:14 am
Quote
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?

Quote
the code i wrote i finished it , i but it just to understand for whom reading my topic ...
??? Can you post your finished code.
250  Using Arduino / Programming Questions / Re: need help in my programe . on: June 16, 2014, 11:04:06 am
Quote
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.

Quote
  delay(4000);
  robot_left();
  if (sen4_val==HIGH){robot_stop();
  delay(1000);
  robot_down();
  delay(8000);
  robot_arm_hold();
  delay(3000);
  robot_arm_stop();
  delay(1000);
  robot_up();
  delay(3000);
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?
251  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.
252  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.
253  Using Arduino / Displays / Re: Trouble compiling examples for the UTFT Library on: June 16, 2014, 08:49:32 am
Quote
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?
254  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?
255  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.
Pages: 1 ... 15 16 [17] 18 19 ... 229