int numBlinks;
String msg="How many blinks do you want:";
int bt=500;
int redPin=12;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(redPin, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
// To get data from the serial port we have to Ask, Wait, Read.
Serial.println(msg);
// Wait until theres data on the serial port
while(Serial.available()==0){
}
numBlinks=Serial.parseInt();
for(int j=0; j < numBlinks; j++){
digitalWrite(redPin,HIGH);
delay(bt);
digitalWrite(redPin, LOW);
delay(bt);
}
}