Hi all, I am facing this problem while trying to get motor speed control done on my arduino project.
I have created a java applet to send these signals to my arduino board:
w - Forward
a - Left
s - Reverse
d - Right
z - Low Speed
x - Normal Speed
c - High Speed
how can i assign each speed to my determined direction control in my arduino codes ?
this is how my codes look like:
int value = 255;
void loop(){
char id = Serial.read();
switch (id){
//Move Forward
case 'w':
digitalWrite(M1,HIGH);
digitalWrite(M2,LOW);
// analogWrite(E1,value);
// analogWrite(E2,value);
Serial.println("Move Forward");
break;
case 'z':
Serial.println("Low Speed");
analogWrite(E1,value-100);
analogWrite(E2,value-100);
break;
All the codes are working, just that i dont know how to assign the speed control to each direction.
Thanks in advance.