Sunday, October 21, 2012

Codes and Stuff


I have all of the code available here in all of the stages
View it as follows, LEDPractice is first, then archive0 is oldest, highest number is most recent archive, current is current.
https://github.com/tgreena/Sensors/tree/master/SensorsProject1-LED
Here is another backup I did, I forget at which point this was though... http://pastebin.com/5ThjKNBd

I figured out a way to display words on the LED without having to use those large obnoxious matrices of 1's and 0's how we had it earlier https://github.com/tgreena/Sensors/tree/master/SensorsProject1-LED
What was happening with the matrices was if you tried to display too many characters in a row or have too many words totally on on the board, the arduino would run out of memory and wouldn't display anything. The work around for this was to find an alternative way to display characters on the arduino, because the large matrices weren't cutting it. Luckily I had been browsing arduino and raspberry pi forums and I came across this post http://kimondo.co.uk/raspberry-pi-arduino-8x8-led-matrix/ about using an arduino and a raspberry pi to control an 8x8 LED matrix with Python. I literally thought to myself "jackpot!" I seriously found the post Saturday. I looked and saw they were using an interesting way of converting hexadecimals into keyboard characters. I was able to cut out and rearrange the code into the code I was working with to replaced all those matrices with nice hexadecimal codes for all the characters. Another thing was I went around from if statements with conditionals to the random number generator to pick a random string. At first I was using the arduino random(int,int) function. It totally sucks because it picks the same numbers every time in the same order. So much for random… Well I got a library that does true random and added it in there.

The last problem was the microphone sample happened so fast that unless you are talking at that exact moment of the sample, it wouldn't catch it. What I did was I made the microphone sample the volume several times very quickly, and each time it sampled it it would keep the loudest value. It ended up working really well because it gives the viewer an opportunity for their voice to be heard.


On a side note
http://codeandlife.com/2012/07/29/arduino-and-raspberry-pi-serial-communication/
I started looking into it more and I found a guide on using the Arduino and the raspberry pi with serial communication in addition to the 8x8 LED matrix with the arduino and raspberry pi. I am interested in doing a tutorial for the class once I figure it out.

No comments:

Post a Comment