Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int led [6]={5,6,7,8,9,10};
- int i;
- int x;
- // the setup routine runs once when you press reset:
- void setup() {
- pinMode(A1, INPUT);
- for(int i=0;i<6;i++)
- pinMode(i, OUTPUT);
- }
- // the loop routine runs over and over again forever:
- void loop() {
- x= analogRead(A1);
- i=map(x,0,1023,0,6);
- proceso(i);
- }
- void proceso(int i)
- {
- digitalWrite(led[i], HIGH); // turn the LED on (HIGH is the voltage level)
- //delay(10); // wait for a second
- digitalWrite(led[i], LOW); // turn the LED off by making the voltage LOW
- //delay(50); // wait for a second
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement