Skip to content

Lab 6: Serial Out using an Arduino

June 14, 2009

This is a pretty interesting lab.  The set-up is the same as before, with the pot outputting to analog pin 0:


Here’s the program and the serial output:

Serial Out Sketch Output Range

Because of the BYTE modifier in the Serial.print () command, instead of outputting the numerical value of the voltage from the pot mapped between 0 and 1023 as we did before, the Arduino is outputting the raw binary values.  My laptop is reading that serial data and assuming it needs to show the ASCII characters conforming to those binary values.  I rolled the pot through its whole range from min to max and back again.  The serial output starts and ends with a ‘!’, and in the middle range there’s a ‘ÿ’.  Whatever that is.  Those correspond to the decimal numbers 33 and 152.  The 33 makes sense, as there’s blank space at either end of the range (outside the exclamation points), and there are no ASCII characters under 33–they’re all spaces and commands.  At the upper end, though, I do not really understand why I’m not getting ASCII characters corresponding to 254, or close.  

Here are the ASCII tables:


Here is the serial output in Terminal as well.  The range of sensitivity doesn’t seem to be the same, judging from the highest level ASCII character received.  It also didn’t seem as sensitive to turning the pot:

Terminal Picture 1 cropped

Here’s the serial output graphed in Processing, with the code below:

Processing Picture 1 Window

Processing Picture 1 sketch

Definitely more fun to look at than ASCII characters!

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: