Assignment 8 – Serial Communication Lab

Working thru the lab – I had no problem with graphing my potentiometer. Then switched it up using a photo sensor. The hardest part of this one was using my left hand to change the light reading while doing an image capture with my right hand. The graph illustrates a rapid tapping of the sensor to block the light.

 


 

 

 

 

 

 

The dimmer tutorial was straight forward. I did not have any 220 ohm resistors so used a 330. It didn’t work but I think it had more to do with how I wired the Arduino. Anyway, I did replace the resistor and re wired the board (looking at an earlier lab using an LED) and it worked really well. Switching up the LED with the Servo Motor was a bit more challenging. I looked at both the Code examples in the Servo Example folder and chose the Knob example to emulate. It “seemed” to work but I felt there was very little control using the Processing gradient. Perhaps my code is wrong. The servo would sweep back and forth if I moved the mouse quite quickly and beyond the borders of the screen? And it also jumped around a bit when I first opened the Processing sketch.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Now for data types; The tutorial for serial call/response was a bit challenging. I see how “doing” is “learning” because I often make mistakes wiring and have to figure that out. The Processing sketch worked fine but the fun began when I tried to change the ball colour and background. Changing size is easy. I think that I have to use an if/else statement in the draw function, and so tried a lot of different things. At first I tried an if statement based on the boolean variable in the code. Now I think that I need to look carefully at the Arduino code and perhaps write an if/else statement based on information received from the button sensor. But that still doesn’t work. I think I need to move on. If I do figure it out, I will post the new code!

Comments are closed.