Go Down

Topic: imput from keyboard (Read 499 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
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy