Go Down

Topic: imput from keyboard (Read 461 times) previous topic - next topic

jucasan

I'm just trying to get started and I was wondering about how to imput data from keyboard. What should I ad to this code in order to ask the operator for the value of delayValue? thanks



int ledPin13 = 13;// LED connected to digital pin 13
int ledPin12 = 12;
int ledPin11 = 11;
int ledPin10 = 10;
int delayValue =1000;

void setup()                    // run once, when the sketch starts
{
 pinMode(ledPin13,OUTPUT);   // sets the digital pin as output
 pinMode(ledPin12,OUTPUT);
 pinMode(ledPin11,OUTPUT);
 pinMode(ledPin10,OUTPUT);
}

void loop()                     // run over and over again
{
 digitalWrite(ledPin13, HIGH);   // sets the LED on
 delay(delayValue);                  // waits for a second
 
 digitalWrite(ledPin12,LOW);// led 12
 delay(delayValue);
 
 digitalWrite(ledPin11,HIGH); //led 11
 delay(delayValue);
 
 digitalWrite(ledPin10,LOW); //led 10
 delay(delayValue);
 
 digitalWrite(ledPin13, LOW);    // sets the LED off
 delay(delayValue);                  // waits for a second
 
 digitalWrite(ledPin12,HIGH);
 delay(delayValue);
 
 digitalWrite(ledPin11,LOW);
 delay(delayValue);
 
 digitalWrite (ledPin10,HIGH);
 delay (delayValue);
 
 
}

Go Up