« comics | Main | property in the digital age »

serial communication

For this lab I used a photo sensor and a flex sensor (they were the first sensor I found in my box).

serial-read.JPG


The first two sections of the lab were easy - just copy and paste and run the code. The third part - reading serial communication via hyperterminal - required more figuring out. You have to program the arduino first, close the program (to free up the port), then open hyperterminal to connect to the port. Once you make a connection you can start playing around with the values. I found the readings much easier to interpret if I used println instead of just print (or else they are just a bunch of jumbled up numbres). This actually is a pretty neat program for finding the range of all your sensors.

Next thing was making this talk to Processing. BG and FG color aren't set in the example code, so it helps to set, or else they both default to black. My COM3 connection was actually the 2nd element in Serial.list - Serial.list()[1] - so after setting that I was able to get a reading back. Controlling the dot with flex sensor and photocell is actually really hard becaues of the range of values you get, so it helps to scale it to 0~265. My initial readings were in the 50's range so I just neded to times that by 4.