Lab: Multiple Serial Output

I used an accelerometer and a push button as my two sensors.

When the line of code read Serial.println(analogValue, DEC); the number that read on the serial monitor was 489 when my breadboard was not moving, and ranged from 300-700 when i shook it around.

With the line of code as Serial.println(analogValue, BYTE); the serial monitor was going all over the place with all kinds of characters when I was moving the breadboard around, and at rest it seemed to like this character best:

Î

So I just noticed, the given code in step #3 is incorrect, in the line that reads analogValue=analogRead(analogPin); under the void loop() should have the “/4” before the “;”. That is why my readings were not between 0 and 255 like they were supposed to be. When I added the “/4” to the code, the DEC I got numbers within the expected range and with BYTE I got characters that were much less obscure than the first go around.

With step #4, sending the data in many formats, my serial read turned out like this:

success!

Next I tried the Punctuation method and read it through Cornflake Serial monitor and then through the given Processing sketch. Also success.

Now I tried the Handshake method

This entry was posted in Labs. Bookmark the permalink.

Leave a comment