In anticipation to one of my units this year, i've been working on a number of arduino programs during the uni break.
when i started with arduino there were a few early programs that allowed you to create a blinking light on a variable timer. at first i wanted to create a program that would allow multiple lights to flash on indipendant timers, but i found that within arduino, you can only set a single loop of code, so writing the code was going to be very tedious.
each letter reprisents one line of code (blue on and black off) per 10ms with 5 variable lights if i had to write out the code for one continuous loop. i never actually found the point where they all meet up again but gave up this idea at this point because the lights would have to be on a set time and it wouldnt be as good to experiment with.
I began exploring the idea of metering audio and after watching a few tutorials, created a program that took information from max/MSP and sent it to the arduino for one channel of audio, and metered over 12 LED's. My journey became much more difficult when i tried to send two seperate integers through the programs (to meter a left and right channels).
I came across a kind of code called ASCII (American Standard Code for Information Interchange) that could sent multiple intergers, letters and symbols through the serial port as bytes. from there the arduino decodes the information and applies it to the program. This was the ultimate solution to most of my issues, but it took a bit of fine tuning for me to get the program running as quickly as it does now.
You can see pictures of the code set for 12 varible lights below.
This code sets 12 separate variables and turns on all the LED outputs.
Here the code says that if 12 bytes of information come through, set the the first byte as "vl", set the second as "va" etc. and then states that if a variable is 1, then the LED connected to that would react and turn on, and turn off if the variable is 0.
whenever the status of a switch is changed it sends a slightly delayed bang so that the information can enter the pack first. the information passes to a sprintf to add the full stop at the end of the 12 bytes of code (sending as 24 bytes including the spaces between the ones and zeros and for some strange reason it just works better with the full stop at the end).
0 Comments
Leave a Reply. |
AuthorMy name is Daniel Ohm and this section will include my research into music theory, experimental ideas, Mixing techniques and lessons learned from creative forums and musical endeavors. Archives
September 2022
Categories |