Edited by Crypter at Wed Mar 11, 2015 07:30 |
Despite my troubles with the ethernet card (LeMaker, shame on you for ignoring this!) on my BananaPi I was working on this project and now I'm finally done with it!
Technically, this is just one very precise, very fast, customizable LED Blinky. Other than that can be used to tune string instruments and "stop" the motion of your computer cooling fans.
-"How on earth do you tune musical instruments with a freaking LED?!"
The answer is - easy. And very, very accurately. A string instrument vibrates it's wires to make sound, each note has a precise frequency of X Hz (ex. A is 440Hz). If you pulse a light at that string at 440Hz you'll "freeze" it in time because you'll be able to see the string at the very same position every time. If the frequency is 441Hz or 439Hz it will be slowly moving, very easy way to notice if you are out of tune.
The same principle goes for rotating fans and engine shafts and speaker membranes.
Now, when I told you the fun part about it it's time for some technical documentation (the Too Long Didn't Read part)...
The program uses ncurses library, it means it has a very nice (G)UI when you run it inside a SSH session/terminal. The screenshot below is pretty self explanatory...
While it's working it will rape one of the CPU cores and hold it to 100% usage, that's because I'm checking about 1 million times a second if the LED should be ON or OFF. Don't worry, it's OK unless you forget it running for like... a day (highly unlikely that will happen anyway). I can use TVHeadend and watch TV on my laptop while this is running, The BananaPi can handle it easily.
The source is compiled using
The source and a precompiled binary can be found here Copy the Code
- gcc -O7 -o strobe strobe.c -lrt -lncurses -lwiringPi
Give permissions to the binary to be executed with "chmod 777 /location/of/file/strobo"
Run it with "./strobo" or "/location/of/file/strobo"
This is how the LED should be connected to the BananaPi