Open Msnvs opened 7 months ago
Servo ESC; int Velocity = 0; char dataIn ='S';
char determinant; char det; int IN1=5; int IN2=6; int IN3=10; int IN4=11;
void setup(){
Serial.begin(9600); analogWrite(IN1, 0); analogWrite(IN3, 0); analogWrite(IN2, 0); analogWrite(IN4, 0); }
void loop(){ det= check(); while (det == 'F'); { analogWrite(IN1 ,0); analogWrite(IN4 ,0); analogWrite(IN2 ,velocity); analogWrite(IN3 ,velocity); det = check(); } while(det =='B'); { analogWrite(IN3 ,0); analogWrite(IN2, 0); analogWrite(IN1 ,velocity); analogWrite(IN4, velocity); det = check(); } while(det =='L'); { analogWrite(IN3 ,0); analogWrite(IN1 , 0); analogWrite(IN4 , velocity); analogWrite(IN2 , velocity); det = check(); } while (det == 'R'); { analogWrite(IN4, 0 ); analogWrite(IN2, 0); analogWrite(IN3 ,0); analogWrite(IN1, 0); det == check(); } while (det =='S'); { analogWrite(IN1, 0); analogWrite(IN2, 0); analogWrite(IN3, 0); analogWrite(IN4, 0); det == check(); } } int check(){ if (Serial.avariable () > 0) } { dataIn = Serial } } } {
include
Servo ESC; int Velocity = 0; char dataIn ='S';
char determinant; char det; int IN1=5; int IN2=6; int IN3=10; int IN4=11;
void setup(){
Serial.begin(9600); analogWrite(IN1, 0); analogWrite(IN3, 0); analogWrite(IN2, 0); analogWrite(IN4, 0); }
void loop(){ det= check(); while (det == 'F'); { analogWrite(IN1 ,0); analogWrite(IN4 ,0); analogWrite(IN2 ,velocity); analogWrite(IN3 ,velocity); det = check(); } while(det =='B'); { analogWrite(IN3 ,0); analogWrite(IN2, 0); analogWrite(IN1 ,velocity); analogWrite(IN4, velocity); det = check(); } while(det =='L'); { analogWrite(IN3 ,0); analogWrite(IN1 , 0); analogWrite(IN4 , velocity); analogWrite(IN2 , velocity); det = check(); } while (det == 'R'); { analogWrite(IN4, 0 ); analogWrite(IN2, 0); analogWrite(IN3 ,0); analogWrite(IN1, 0); det == check(); } while (det =='S'); { analogWrite(IN1, 0); analogWrite(IN2, 0); analogWrite(IN3, 0); analogWrite(IN4, 0); det == check(); } } int check(){ if (Serial.avariable () > 0) } { dataIn = Serial } } } {