Kanamex

S05-Práctica1.2-Display-7-segmentos

Jun 22nd, 2021
788
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int pinA = 2;
  2. int pinB = 3;
  3. int pinC = 4;
  4. int pinD = 5;
  5. int pinE = 6;
  6. int pinF = 7;
  7. int pinG = 8;
  8. int e = 1500;
  9. void setup(){
  10. pinMode (pinA, OUTPUT);
  11. pinMode (pinB, OUTPUT);
  12. pinMode (pinC, OUTPUT);
  13. pinMode (pinD, OUTPUT);
  14. pinMode (pinE, OUTPUT);
  15. pinMode (pinF, OUTPUT);
  16. pinMode (pinG, OUTPUT);
  17. }
  18. void loop(){
  19. //CERO
  20. digitalWrite (pinA, LOW);
  21. digitalWrite (pinB, LOW);
  22. digitalWrite (pinC, LOW),
  23. digitalWrite (pinD, LOW);
  24. digitalWrite (pinE, LOW);
  25. digitalWrite (pinF, LOW);
  26. digitalWrite (pinG, HIGH);
  27. delay (e);
  28. //UNO
  29. digitalWrite (pinA, HIGH);
  30. digitalWrite (pinB, LOW);
  31. digitalWrite (pinC, LOW);
  32. digitalWrite (pinD, HIGH);
  33. digitalWrite (pinE, HIGH);
  34. digitalWrite (pinF, HIGH);
  35. digitalWrite (pinG, HIGH);
  36. delay (e);
  37. //DOS
  38. digitalWrite (pinA, LOW);
  39. digitalWrite (pinB, LOW);
  40. digitalWrite (pinC, HIGH);
  41. digitalWrite (pinD, LOW);
  42. digitalWrite (pinE, LOW);
  43. digitalWrite (pinF, HIGH);
  44. digitalWrite (pinG, LOW);
  45. delay(e);
  46. //TRES
  47. digitalWrite (pinA, LOW);
  48. digitalWrite (pinB, LOW);
  49. digitalWrite (pinC, LOW);
  50. digitalWrite (pinD, LOW);
  51. digitalWrite (pinE, HIGH);
  52. digitalWrite (pinF, HIGH);
  53. digitalWrite (pinG, LOW);
  54. delay (e);
  55. //CUATRO
  56. digitalWrite (pinA, HIGH);
  57. digitalWrite (pinB, LOW);
  58. digitalWrite (pinC, LOW),
  59. digitalWrite (pinD, HIGH);
  60. digitalWrite (pinE, HIGH);
  61. digitalWrite (pinF, LOW);
  62. digitalWrite (pinG, LOW);
  63. delay (e);
  64. //CINCO
  65. digitalWrite (pinA, LOW);
  66. digitalWrite (pinB, HIGH);
  67. digitalWrite (pinC, LOW);
  68. digitalWrite (pinD, LOW);
  69. digitalWrite (pinE, HIGH);
  70. digitalWrite (pinF, LOW);
  71. digitalWrite (pinG, LOW);
  72. delay (e);
  73. //SEIS
  74. digitalWrite (pinA, LOW);
  75. digitalWrite (pinB, HIGH);
  76. digitalWrite (pinC, LOW);
  77. digitalWrite (pinD, LOW);
  78. digitalWrite (pinE, LOW);
  79. digitalWrite (pinF, LOW);
  80. digitalWrite (pinG, LOW);
  81. delay (e);
  82. //SIETE
  83. digitalWrite (pinA, LOW);
  84. digitalWrite (pinB, LOW);
  85. digitalWrite (pinC, LOW),
  86. digitalWrite (pinD, HIGH);
  87. digitalWrite (pinE, HIGH);
  88. digitalWrite (pinF, HIGH);
  89. digitalWrite (pinG, LOW);
  90. delay (e);
  91. //OCHO
  92. digitalWrite (pinA, LOW);
  93. digitalWrite (pinB, LOW);
  94. digitalWrite (pinC, LOW),
  95. digitalWrite (pinD, LOW);
  96. digitalWrite (pinE, LOW);
  97. digitalWrite (pinF, LOW);
  98. digitalWrite (pinG, LOW);
  99. delay (e);
  100. //NUEVE
  101. digitalWrite (pinA, LOW);
  102. digitalWrite (pinB, LOW);
  103. digitalWrite (pinC, LOW),
  104. digitalWrite (pinD, HIGH);
  105. digitalWrite (pinE, HIGH);
  106. digitalWrite (pinF, LOW);
  107. digitalWrite (pinG, LOW);
  108. delay (e);
  109. //SEPARADOR
  110. digitalWrite (pinA, HIGH);
  111. digitalWrite (pinB, HIGH);
  112. digitalWrite (pinC, HIGH),
  113. digitalWrite (pinD, HIGH);
  114. digitalWrite (pinE, HIGH);
  115. digitalWrite (pinF, HIGH);
  116. digitalWrite (pinG, LOW);
  117. delay (e);
  118. }
RAW Paste Data