Week 4 Readings and Labs

Serial communication, or how devices talk to each other. 

So two devices have to set certain protocols before they can begin to communicate: the rate at which data is sent/read (data rate), the voltage levels representing 1 and 0, and the type of logic for what 1/0 mean (true logic versus inverted logic). There are three wires as well that need to be used to make the connection between devices - the common ground, the transmit wire, and the receive wire.

Processors are equipped with Universal Asynchronous Receiver Transmitters (UARTS) to communicate via the TTL serial protocol, but most personal computers have Universal Serial Buses (USBs) to communicate with multiple devices. All processors with a UART store incoming data in a serial buffer in memory, where they read the bits in FIFO order. Sensors can send data in ASCII format in order to read data being sent from two sensors - ASCII assigns unique codes to characters so that you can use certain characters as a divider between readings. 


The Reading Input on an Arduino lost me - the code kind of makes sense but I don't get exactly why it works. Other than that they seem to make sense... maybe...


So hey, did you know that serial ports can only be used by one program at a time? I ran the code for Serial Output from an Arduino in Arduino and remembered that I had to stop it before running CoolTerm (Arduino crashed spectacularly at this point). Here's a screenshot of what the hex values looked like

Hex fun

This lab also made me get Processing (funny how the IDE resembles Arduino's, but Eclipse is still my favorite IDE). 

I had to modify the code to pick the last one out of six but it worked! FIRST PROCESSING SKETCH, WHOO!

For the Two-Way Serial Comm. Lab, I used a pressure sensor in addition to my potentiometer since I don't have an accelerometer. However I had trouble with the rest of the lab when the Processing started because I'm not too familiar with the syntax and the code got a little confusing. I'm not sure what's going on in it, can we talk this over please?