Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. //lAB 2
  2. //Crhistian David Lucumi
  3. //Usc
  4. //Version 1.0
  5.  
  6. int pot_on=A0;
  7. int pot_off=A1;
  8. #define MAX 9
  9. int led[MAX]={
  10. 5, 6, 7, 8, 9, 10, 11, 12, 13};
  11. int t_off;
  12. int t_on;
  13.  
  14.  
  15. void setup(){
  16. for(int pin=0; pin<=MAX;pin++){
  17. pinMode(led[pin], OUTPUT);
  18. pinMode(pot_on, INPUT);
  19. pinMode(pot_off, INPUT);
  20. }
  21. }
  22.  
  23.  
  24. void loop(){
  25. for (int pin =0; pin <= MAX; pin++){
  26. prender(led[pin], t_on);
  27. apagar(led[pin], t_off);
  28.  
  29. t_on= analogRead(pot_on);
  30. t_off= analogRead(pot_off);
  31. }
  32. }
  33.  
  34. void prender(int le, int tem){
  35. digitalWrite(le, HIGH);
  36. delay(tem);
  37.  
  38. }
  39. void apagar(int le, int tem){
  40. digitalWrite(le, LOW);
  41. delay(tem);
  42.  
  43. }