Class Notes (836,650)
Canada (509,869)
IAT 267 (14)

IAT267_Week 7.docx

4 Pages
Unlock Document

Interactive Arts & Tech
IAT 267
Helmine Serban

Arduino Serial Library Library-a collection of procedures, where all the procedures are related The library used is the Serial Library which allows the Arduino to send data back to the computer Serial Comm. Functions Serial.begin(speed) int Serial.available() int Serial.flush() Serial.print(data) Serial.printlm(data) Serial.begin(int speed) Sets the data rate in bits per second (baud) for serial data transmission For communicating with the computer, use one of these rates: -300, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, or 115200 void setup() { Serial.begin(9600); // opens serial port, sets data rate to 9600 bps } int Reads incoming serial data Returns an int, the first byte of incoming serial data available (or -1 if no data available) Controlling the Computer Can send data from Arduino to computer with Serial.print() There are many different variations Receiving program on the computer can be in any language that knows about serial ports -C/C++, Perl, PHP, Java, Max/MSP, Python, Visual Basic, Processing, etc. E.g. serial read blink -type in a number 1-9 and LED blinks that number -converts number typed into usable number char val = val – ‘0’: converts from char to number -characters are stored as numbers however, you can see the specific encoding in the ASCII chart -it is possible to do arithmetic on characters in which the ASCII value of the character is used Serial Communication between Arduino and Processing Only one prog
More Less

Related notes for IAT 267

Log In


Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.