Sep. 27......Data
Assignment Journal 03
I wanted to make a lighting device that assembles braille: when I press the switch for the first time, the lights will light up to form the symble of "1" goes on till the six time of pressing the button. Then it starts from 1 again.
There are several steps to do the effect.
make the LEDs go one by one. Get the times I press the button and mod it by 6 so that it'll jump back to 1 after 6.
see the code
The second one is to make the light that was originally lit to go off.(Sounds easy, but I spent a lot of time)
see the code
When I press the first button, instead of a certain LED lights up, a goup of LEDs that reprent the number(ex. 1,2, 3...6) should light up.
In step 2, I kept facing the problem that the last LED won't go off. Obviously it is because when it goes back to the first LED, it makes the "pin" before it to go off, instead of the last one of the LED group. I tried to fix the problem by the way I did to light them up. The somehow I couldn't work it out. So I cheated, I get the one that was lit and set it to the variable before the next LED lights up. If you know how to do it with mod, please email me. Thank you~(
Another problem that is left unsoved is, I wrote a sub program to decide which leds should light up, but it starts to frantically go round and round even I just press once.... The script I use to count the times seems not working any more.
Follow Up
I didn't use a "do while" loop in the codes so I changed the second "if..then" to "do while", move it to the bottom of the command, and then it worked. Now when I press the switch for the first time, the LEDs that represent letter "a" will light up...and so on. I didn't I need more LEDs to form the symbols of numbers, so I changed from number 1, 2, 3 to letter a, b. c.
Graphic and code and chart....see the chartsee the code
LEDs light up according to the times I press the switch.