Final Project Progress – by Cole and Shreya

Please read through my previous blog post if you haven’t to better follow this one ­čÖé

Once Cole and I had finalized our idea for the final project, the first very important thing was to finalize the instructions for bomb diffusion. We both had a preliminary idea on how our game should work – have LEDs light up to give a signal, press buttons according to that, this should give you the next task to do and a few such tasks should culminate in cutting a wire. This seemed very easy until we started making a plan. We realized, there were a lot of things to consider, and based on that, we could have many permutations of things we could do / signals and tasks we could create. So we decided on the things we will be using on our Arduino board for input and output first. Due to limited pins, we had to maximize what we could use and different signals we could create. We decided on 4 LEDs as output signals and 4 buttons (different colors), potentiometer, and distance meters as inputs. We made a complete plan on how to start, which instruction will lead to what and so. It can be found below. And I must mention, it took longer than we thought and harder than we assumed to chart this plan!

 

 

After this plan was made, Cole and I decided to first get started with some basics of our Arduino and interface on Processing.

Interface of Processing

We decided to start with the interface first because once we have the visualization, it will be easy to display the Arduino reads on the screen and check if our code/wiring is appropriate or not. Also, it is very hard to code the entire logic with no visible output. So, once we integrate Arduino with processing, we should be able to see the results on the screen.

I started with sketching the wires. I was thinking about how it could be possible to have wires disappear once they are cut. The best way I could imagine was draw these pieces individually and then display the appropriate wires based on their state (1 for uncut and 0 for uncut).

Next, I wanted to try to make the distance meter and potentiometer reading on screen. For testing purposes, I made them map to mouseX. This will be switched to Arduino readings later. The rotation of the needle was a little hard to achieve because I wanted it to pivot over a very particular point in the image. With a little trial and error and some calculations, I think I got that right!

You can find the working videos below:

I am currently working on displaying the bomb timer/countdown on the screen. This is proving to be a bit challenging. After this, I will start with the driver program for the game which is the LED sequences, and randomizing those. Based on that, the code for the rest of the game will follow. Each LED sequence needs to wait for input and update multiple flag variables and then change the sequence to give the next signal. I have charted out a plan on how this will work… implementation will hopefully follow soon ­čÖé

Arduino Part

For the Arduino part, Cole finished creating the Arduino with all the wiring. On the board, we have 4 LEDs, 4 buttons with corresponding colors to the LEDs, a potentiometer, a distance sensor, and a buzzer.

We have also completed the Arduino code needed to control the whole board from  Processing as well as send the inputs from the sensors back.

Here is the Arduino circuit (note the distance meter in Tinkercad is a 3 pin, not a 4 pin variant like we have so I just placed 4 wires in the top left corner where the distance meter is actually at)

Tinker-cad Model
Actual Arduino

Code

For the above, I have started with creating a few classes (currently have one for the wires, more are to come for the timer and LEDs). I have also broken down the into various sections and made functions based on different game stages / input we are waiting for from the bomb diffuser.

The Arduino code has also been completed by Cole as mentioned above.

For the full code (Arduino and Processing), you can follow this GitHub link.

 

Leave a Reply