stuff
Dependencies: mbed Servo Motor
Diff: confetti.cpp
- Revision:
- 4:439279a72ef4
- Parent:
- 3:e3b0e591e976
--- a/confetti.cpp Tue Oct 15 17:52:08 2019 +0000 +++ b/confetti.cpp Tue Oct 15 18:07:33 2019 +0000 @@ -4,7 +4,7 @@ DigitalIn switches [5] = {p15, p16, p17, p18, p19}; - +DigitalOut lights [5] = {p10, p11, p12, p13, p14}; Servo gun (p24); Servo spin (p23); Motor jeff (p26, p29, p30); @@ -24,15 +24,17 @@ // switch 1 on and 2 off if ((h [0] == 1) && (h [1] ==0)) { jeff.speed (0.5); + lights[0] = 1; } // switch 1 off and 2 on if ((h [0] == 0) && (h [1] == 1)) { jeff.speed (-0.5); + lights[1] = 1; } // switch 1 off and 2 off - if (((h [0] == 0) && (h [1] == 0)) || ((h [0] == 1) && (h [1] == 1)) ){ - + if (((h [0] == 0) && (h [1] == 0)) || ((h [0] == 1) && (h [1] == 1)) ) { jeff.speed (0); + lights[2] = 1; } // switch 3 on and 4 off if ((h [2] == 1) && (h [3] ==0)) { @@ -42,7 +44,7 @@ spin = i; wait (0.1); i = i + 0.02; - + lights[3] = 1; } // switch 3 off and 4 on @@ -53,6 +55,7 @@ spin = i; wait (0.1); i = i - 0.02; + lights[4] = 1; } // switch 3 off and 4 off if (((h [2] == 0) && (h [3] ==0))|| ((h [2] == 1) && (h [3] ==1))) {