• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# Arduino Nano Multiplication/Division Signs

Braulio777 Jul 12th, 2017 (edited) 117 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. //Arduino Nano Multiplication/Division Signs
2. /*This project is an excellent tool for teaching in the levels of elementary school because it was designed thinking in math operacions where multiplication and division signs are involved. That is, you press SW1, and you combine plus(+) times plus(+). Then the result will be plus (+). If you press SW2, you will combine plus(+)times minus(-); therefore, the result will be minus (-) while pressing SW3, you will combine minus (-) times minus (-) and your result will be plus (+). */
3. /* The materials are: 1-Arduino Nano, 5-10mm Red LED, 3-Pushbutton Switch, 5-470 Ohm Resistor for the LEDs, and 3-10k Resistor for connecting to the switches*/
4. int LED_1=2;
5. int LED_2=3;
6. int LED_3=4;
7. int LED_4=5;
8. int LED_5=6;
9. int d1=7;
10. int SW1=8;
11. int SW2=9;
12. int SW3=10;
13. int di=20;
14. int d=1000;
15.
16. void setup(){
17. pinMode(LED_1, OUTPUT);
18. pinMode(LED_2, OUTPUT);
19. pinMode(LED_3, OUTPUT);
20. pinMode(LED_4, OUTPUT);
21. pinMode(LED_5, OUTPUT);
22. pinMode(d1, OUTPUT);
23. pinMode(SW1, INPUT);
24. pinMode(SW2, INPUT);
25. pinMode(SW3, INPUT);
26. }
27. void loop(){
31. if(SW1==LOW && SW2==LOW && SW3==LOW){
32. digitalWrite(LED_1, HIGH);
33. delay(di);
34. digitalWrite(LED_1, LOW);
35. delay(di);
36. digitalWrite(LED_2, HIGH);
37. delay(di);
38. digitalWrite(LED_2, LOW);
39. delay(di);
40. digitalWrite(LED_3, HIGH);
41. delay(di);
42. digitalWrite(LED_3, LOW);
43. delay(di);
44. digitalWrite(LED_4, HIGH);
45. delay(di);
46. digitalWrite(LED_4, LOW);
47. delay(di);
48. digitalWrite(LED_5, HIGH);
49. delay(di);
50. digitalWrite(LED_5, LOW);
51. delay(di);
52. digitalWrite(d1, LOW);
53. delay(di);
54. }
55. if(SW1==HIGH && SW2==LOW && SW3==LOW){
56. //Sign plus times sign plus (+)(+) = +
57. digitalWrite(LED_1, HIGH);
58. digitalWrite(LED_2, HIGH);
59. digitalWrite(LED_3, HIGH);
60. digitalWrite(LED_4, HIGH);
61. digitalWrite(LED_5, HIGH);
62. digitalWrite(d1, LOW);
63. delay(d);
64. }
65. if(SW1==LOW && SW2==HIGH && SW3==LOW){
66. //Sign plus times sign minus (+)(-) = -
67. //Or
68. //Sign minus times sign plus (-)(+) = -
69. digitalWrite(LED_1, HIGH);
70. digitalWrite(LED_2, HIGH);
71. digitalWrite(LED_3, HIGH);
72. digitalWrite(LED_4, LOW);
73. digitalWrite(LED_5, LOW);
74. digitalWrite(d1, LOW);
75. delay(d);
76. }
77. if(SW1==LOW && SW2==LOW && SW3==HIGH){
78. //Sign minus times sign minus (-)(-) = +
79. digitalWrite(LED_1, HIGH);
80. digitalWrite(LED_2, HIGH);
81. digitalWrite(LED_3, HIGH);
82. digitalWrite(LED_4, HIGH);
83. digitalWrite(LED_5, HIGH);
84. digitalWrite(d1, LOW);
85. delay(d);
86. }
87. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.
Top