Skip to content

PComp: Serial makes me dizzay

For this week, we had to do two labs. The first one was the Intro to Asynchronous communication. Thankfully, we covered this extensively in class and I felt I understood it. And I feel for the most part I did. The theory part of it makes complete sense, but when it’s time to apply it and figure out what to do and how to do it… I again find myself stumped ::sigh:: practice makes perfect I guess.

The big question I have is that we’re using the same variable to read all three of the sensors. But, wouldn’t you need a different variable for all three? I’m assuming “sensorValue” was a name given to the variable by us, and not predetermined by the computer, correct?

Screen Shot 2015-10-08 at 4.21.53 PM Screen Shot 2015-10-08 at 4.24.34 PM Screen Shot 2015-10-09 at 12.19.06 PM Screen Shot 2015-10-09 at 12.39.10 PM

For the second lab, the serial input to P5, I understood that too. I’ve been reading through the labs first and I think that’s helping, but I’m wondering if I have to include all of the functions always (serverConnected, portOpen, serialEvent, serialError, portClose, graphData) or if we can just include the graphData one for the input and not the others. I understand that they’re probably great for debugging, but something it just makes the code content heavy.
Also, there’s a part in the lab that mentions writing your own serial-to-webSocket server. What does that mean?
Lastly, when writing the callback function for the actions, I’m wondering if the callbacks are determined by the P5/Arduino already, or is that something we can manipulate? (ie: serial.on(‘open’, portOpen);) it seems like it’s something already built in, but I just wonder where that information exists for us to use it.

Screen Shot 2015-10-14 at 4.30.59 PM Screen Shot 2015-10-14 at 11.50.42 AM

Published inPhysComp

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *