double x = 0;
double t;
char input;
double t;
char input;
void setup() {
pinMode(5, OUTPUT);
pinMode(5, OUTPUT);
Serial.begin(9600);
}
void loop() {
if (Serial.available() > 0 )
{
input = Serial.read();
if (input == 's') {
if (x>= 0 && x<=180){
x = x++;
}
}
void loop() {
if (Serial.available() > 0 )
{
input = Serial.read();
if (input == 's') {
if (x>= 0 && x<=180){
x = x++;
}
if (x > 180)
{
x= 0;
}
t = ((100*x) / 18 ) + 1000;
digitalWrite(5, HIGH);
delay(t);
digitalWrite(5, LOW);
delay(30);
}
if (input == 'f') {
if (x>= 0 && x<=360){
x = x++;
}
if (x > 180)
{
x= 0;
}
t = ((100*x) / 36 ) + 1000;
digitalWrite(5, HIGH);
delay(t);
digitalWrite(5, LOW);
delay(30);
}
}
}
No comments:
Post a Comment