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