Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //lAB 2
- //Crhistian David Lucumi
- //Usc
- //Version 1.0
- int pot_on=A0;
- int pot_off=A1;
- #define MAX 9
- int led[MAX]={
- 5, 6, 7, 8, 9, 10, 11, 12, 13};
- int t_off;
- int t_on;
- void setup(){
- for(int pin=0; pin<=MAX;pin++){
- pinMode(led[pin], OUTPUT);
- pinMode(pot_on, INPUT);
- pinMode(pot_off, INPUT);
- }
- }
- void loop(){
- for (int pin =0; pin <= MAX; pin++){
- prender(led[pin], t_on);
- apagar(led[pin], t_off);
- t_on= analogRead(pot_on);
- t_off= analogRead(pot_off);
- }
- }
- void prender(int le, int tem){
- digitalWrite(le, HIGH);
- delay(tem);
- }
- void apagar(int le, int tem){
- digitalWrite(le, LOW);
- delay(tem);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement