So Dragan & I had a great project day Sunday. We figured out a way to kick out of the loop with the wave shield and the rangefinder to make the message not be interrupted. THIS WAS AMAZING. We also added a new sensor to the list, the photocell, to put under the lamp so as people blew on the candle to turn on the lamp, our message would play when the lightbulb sprouted on. And this would continue as each person blew on the candle and therefore, turned the lightbulb on. So for our project we had 3 different types of sensors to be tripped, 2 rangefinders, 1 photocell, and 1 button. A nice group, shall I say. I was so worried that we would not be able to get the rangefinder to work correctly with the wave shield and what do you know; not only do we get the rangefinder to work, but also the photocell to accompany the button. I love how we have progressed so much in this project since the beginning.
So here's what we needed to make all our messages not be interrupted and also play at random. There's a total of 7 messages per group, 4 groups in total. Carlota & Elexis, Kacee & Hayley, Chris & Katie, and Miriam & Elexis.
For the rangefinder, we basically had to comment out all of the conversion lines of code and the serial lines of code that print what inch is detected. Instead, we just used the pwmRange measurement, which is quite different and higher than inches and centimeters. Next we added a variable i and set it to random(7), which is saying play our 7 messages on the wave shield in a random order. I totally forgot about the random function and its use. I remembered using it back in my Processing days. Basically, if the pwmRange is less than 12,000, for every trip play a random wav.
No comments:
Post a Comment