Advertisement
Guest User

Programa Pisca-Pisca Stranger Things

a guest
Feb 27th, 2020
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. char Palavra[] = "PROJETEIROS";
  2.  
  3. const int atraso=2000;
  4.  
  5. const int P=2;
  6. const int R=3;
  7. const int O=4;
  8. const int J=5;
  9. const int E=6;
  10. const int T=7;
  11. const int I=8;
  12. const int S=9;
  13.  
  14.  
  15. void setup()
  16. {
  17. pinMode(P, OUTPUT);
  18. pinMode(R, OUTPUT);
  19. pinMode(O, OUTPUT);
  20. pinMode(J, OUTPUT);
  21. pinMode(E, OUTPUT);
  22. pinMode(T, OUTPUT);
  23. pinMode(E, OUTPUT);
  24. pinMode(I, OUTPUT);
  25. pinMode(R, OUTPUT);
  26. pinMode(O, OUTPUT);
  27. pinMode(S, OUTPUT);
  28.  
  29.  
  30. }
  31.  
  32. void loop()
  33. {
  34. for (int x=0; x<(sizeof(Palavra)-1); x++) {
  35. switch (Palavra[x]) {
  36. case 'P': // your hand is on the sensor
  37. digitalWrite(P,HIGH);
  38. delay(atraso);
  39. digitalWrite(P,LOW);
  40. delay(atraso);
  41. break;
  42. case 'R': // your hand is close to the sensor
  43. digitalWrite(R,HIGH);
  44. delay(atraso);
  45. digitalWrite(R,LOW);
  46. delay(atraso);
  47. break;
  48. case 'O': // your hand is close to the sensor
  49. digitalWrite(O,HIGH);
  50. delay(atraso);
  51. digitalWrite(O,LOW);
  52. delay(atraso);
  53. break;
  54. case 'J': // your hand is close to the sensor
  55. digitalWrite(J,HIGH);
  56. delay(atraso);
  57. digitalWrite(J,LOW);
  58. delay(atraso);
  59. break;
  60. case 'E': // your hand is close to the sensor
  61. digitalWrite(E,HIGH);
  62. delay(atraso);
  63. digitalWrite(E,LOW);
  64. delay(atraso);
  65. break;
  66. case 'T': // your hand is close to the sensor
  67. digitalWrite(T,HIGH);
  68. delay(atraso);
  69. digitalWrite(T,LOW);
  70. delay(atraso);
  71. break;
  72. case 'I': // your hand is close to the sensor
  73. digitalWrite(I,HIGH);
  74. delay(atraso);
  75. digitalWrite(I,LOW);
  76. delay(atraso);
  77. break;
  78.  
  79. case 'S': // your hand is close to the sensor
  80. digitalWrite(S,HIGH);
  81. delay(atraso);
  82. digitalWrite(S,LOW);
  83. delay(atraso);
  84. break;
  85. }
  86. }
  87.  
  88.  
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement