Serial Communication Lab – Hudson

So I finally got to work on the serial communication lab after overcoming the many error messages I was getting (see post below for the solution). The first step was working with some buttons attached to Arduino in order to get an output in Processing.  This wasn’t that dissimilar from the work my group had done for Project 2. See pictures in the YouTube video below.

After that I did the graphing of a sensor output. Again, this wasn’t that different from my work with Project 2; I just had a lot more data! I played around with the colour and tried to apply a smoothing function. The smoothing function didn’t smooth as much as I’d have hoped, perhaps I needed to smooth across more than 2 data read cycles? Nevertheless, moving on! Lots of things to learn…

Recolor graph.

The dimmer was fun. Nick had done the same thing in class so It was nice to see exactly how it was achieved. Swapping out the LED for a servo was a simple matter of calling up the servo example in Arduino and copying and pasting over a few key functions and replacing/removing some values relating to the LED. You can see it in action in the YouTube video below.

I wasn’t really sure what to make of the data types section (4). I wired everything up and got it working. I think I need to go back and compare my work on section 5 with the second section of section 4. This will make the difrences more clear. Nevertheless, I had a clear enough understanding of what was going on to proceed to section 5 and start making edits.

Section 4, part 2 in action.

For exercise 5, I started by mapping the variables received by Processing to allow the on screen element to reach the extents of the screen. Before, when controlling, I was limited to only about a quarter of the screen. I then changed the button’s behaviour through code to allow it to be toggled off and on rather than having to hold it down to keep the onscreen character active. This made more sense to be as now I could operate the x-axis of the white circle with one hand and the y-axis with the other. I then added a gaming element to the code. I did so because moving around a white circle on screen is cool but moving that same circle around a screen to eliminate other red circles is amazing! I used to ‘dist’ function and some randomly generated variables to do this. It wasn’t quite right though. So, lastly, I inverted the mapping of the X position of the white circle. This made the experience play more like traditional side scroller games which begin in the lower left hand corner (Mario, Contra, Sonic) rather than the upper right.

Comments are closed.