Arduino stuff! (catching up on blog posts #1)

Here’s me trying to catch up on everything from this quarter and doing old blog posts:

Arduino work was super fun and super inspirational for my final project! I mentioned in class I wanted my final project to incorporate a microphone in which the deer in my game would scatter if the input is too loud. Turns out this was (relatively) simple from both the hardware and software perspective!

Here was my process:

sensors_2013_01_12_IMG_1157-1024.jpgsensors_2013_01_12_IMG_1162-1024.jpg

There was the part I needed and its accompanying circuit, and here was the code that I found online that goes with it:

  1. while (millis() startMillis < sampleWindow)
  2. {
  3. sample = analogRead(0);
  4. if (sample < 1024) // toss out spurious readings
  5. {
  6. if (sample > signalMax)
  7. {
  8. signalMax = sample; // save just the max levels
  9. }
  10. else if (sample < signalMin)
  11. {
  12. signalMin = sample; // save just the min levels
  13. }
  14. }
  15. }

Basically, in a given sample time frame, it finds the maximum and minimum of a given input single and later converts that into volts and prints it on the screen. The hardest part about incorporating this into my final project will be finding a button to map it to (I may have to use the I-PAC in this case, as I currently am using the left, middle, and right click options on a mouse).

As for the scripting on the DOOM part of it, there is a command I used called Thing_Hate that is exactly what I needed. It was a little annoying getting there though because in order to implement it one has to run a doom script, and in order to do that one has to have the right map format, which caused me to look for the right converter and right format to have a map in. For now I just have the deer sprites hate an arbitrary thing in my map when the user presses the “use” button, but hopefully I can map the microphone input to a button and then have that activate the script!

One thought on “Arduino stuff! (catching up on blog posts #1)”

  1. I am glad that I had a chance to play your game in today’s exhibition. The idea was so well implemented and combined with the hardware. I also tried to use the hardware and had to give up after hours of failure. It is hard to image how much work you had put in it. A fantastic work and an enjoyable experience.

Leave a Reply

Your email address will not be published. Required fields are marked *