int LEDpin = 7;
int lapse = 0;
int inputChar;
int inputNumber;
void setup() {
Serial.begin(9600);
}
void loop() {
lapse=0;
pinMode(LEDpin, OUTPUT);
if (Serial.available()>0){
delay(5);
while (Serial.available()>0){
inputChar = Serial.read();
}
if (inputChar == 'f'){
lapse = 100;
while (lapse > 0){
digitalWrite(LEDpin,HIGH);
delay(lapse);
digitalWrite(LEDpin,LOW);
delay(lapse);
lapse = lapse -5;
}
}
else if (inputChar == 's'){
lapse = 0;
while (lapse < 2000){
digitalWrite(LEDpin,HIGH);
delay(lapse);
digitalWrite(LEDpin,LOW);
delay(lapse);
lapse = lapse+100;
}
}
}
}
int lapse = 0;
int inputChar;
int inputNumber;
void setup() {
Serial.begin(9600);
}
void loop() {
lapse=0;
pinMode(LEDpin, OUTPUT);
if (Serial.available()>0){
delay(5);
while (Serial.available()>0){
inputChar = Serial.read();
}
if (inputChar == 'f'){
lapse = 100;
while (lapse > 0){
digitalWrite(LEDpin,HIGH);
delay(lapse);
digitalWrite(LEDpin,LOW);
delay(lapse);
lapse = lapse -5;
}
}
else if (inputChar == 's'){
lapse = 0;
while (lapse < 2000){
digitalWrite(LEDpin,HIGH);
delay(lapse);
digitalWrite(LEDpin,LOW);
delay(lapse);
lapse = lapse+100;
}
}
}
}
No comments:
Post a Comment