Serial Communication. mouseX from computer to arduino processing sends a single byte of data arduino reads each byte arduino uses value to set light brightness.

Slides:



Advertisements
Similar presentations
Wireless Cue Light Project
Advertisements

Bits and Bytes + Controlling 8 LED with 3 Pins Binary Counting and Shift Registers.
Intro to the Arduino Topics: The Arduino Digital IO Analog IO Serial Communication.
Beginning Arduino Session 2 AN INTRODUCTION TO HACKING THE WORLD’S MOST POPULAR MICROCONTROLLER PLATFORM
Introduction to Sensor Technology Week Four Adam Taylor
1 Arduino Board: Arduino UNO Arduino Programing Environment: Arduino 0022
Basic Circuits – Lab 2 Arduino and Sensors Xmedia Spring 2011.
Parallax 4x20 LCD (part number 27979) with Arduino Duemilanove
ARDUINO PROGRAMMING Working with the Arduino microcontroller.
DataInputFrom Digital PinsUsing an On/OFF button to control an LEDFrom Analog Pins Reading light intensity using a photocell and turning an LED on and.
Arduino Part 2 Topics: Serial Communication Programming Constructs: functions, loops and conditionals Digital Input.
Basic Circuits – Lab 2 Arduino and Sensors
DPNM Lab., POSTECH 1/25 CS490K - Internet of Things (IoT) Jonghwan Hyun DPNM Lab. Department of Computer Science and Engineering, POSTECH
Tele-presence – Connecting Two Processing Platforms via Internet Controlling the Screen based on Distant User Input ServerClient 1.
Intro to the Arduino Topics: The Arduino Digital IO
Ballooning Bundle. What is a Microcontroller? Small computer with a processor core, memory and programmable input/output Continuously repeats software.
ProtoSnaps and Processing Serial Interfacing and Sensor Calibration Materials by Lindsay Craig and Ben Leduc-Mills.
ProtoSnap Introduction to Arduino Casey Haskell, Pete Lewis, David Stillman, Jim Lindblom, Pete Dokter, Lindsay Levkoff, Trevor Zylstra.
INTERFACING WEB SERVER WITH A ROBOT
ATLAS 2013 Super Fast Intro to Arduino and Processing Materials by Lindsay Craig, David Stillman and Ben Leduc-Mills.
MIDI Musical Instrument Digital Interface. MIDI A data communications protocol that describes a means for music systems and related equipment to exchange.
Sparkfun Electronics ATtiny85 Arduino Quick Reference Sheet
Robootika lahenduste esitlus Raul Liinev Martin Ligema Siim Suu Martin Tõnne.
Processing TYWu. Where can I download? 2.0b9 Windows 32-bit.
MediaLive 2012 Danger Shield, Arduino and Processing Materials by Lindsay Craig, David Stillman and Ben Leduc-Mills.
Programming, Serial and Virtual Prototyping. Code if ( You like semicolons ) { Stay here for intro to Arduino code } else { Join the MODKit group for.
ARDUINO 1. Basics  Comments  /* * Blink * * The basic Arduino example. Turns on an LED on for one second, * then off for one second, and so on... We.
Basic Circuits – Lab 4 Serial and OSC (maybe some theory too) Xmedia Spring 2011.
Youn-Hee Han, In-Seok Kang {yhhan, Laboratory of Intelligent Networks Advanced Technology Research Center Korea University of Technology.
Basic Circuits – Lab 5 Wireless Networking Xmedia Spring 2011.
INTERNET OF EVERYTHING SDU 2016 Week 4. Simple Digital and Analog Inputs  The Arduino’s ability to sense digital and analog inputs allows it to respond.
Welcome to Processing Who does not have access to digital camera?
Final Term Project Hi-Tek Smoke Detektor By: Rohan Sharma.
Sequencing Systems & Techniques MIDI Setup. Learning Outcomes Define 2 or more examples of MIDI CC data and explain their purpose. Setup a computer and.
Microcontroller basics Embedded systems for mortals.
ME 120: User-defined functions: average analog input reading Arduino Programming – Part 5: User-defined functions ME 120 Mechanical and Materials Engineering.
Microcontroller basics Embedded systems for mortals.
ME 120: Arduino Programming Arduino Programming Part II ME 120 Mechanical and Materials Engineering Portland State University
Arduino + Bluetooth TYWu. Connection Arduino + Bluetooth Module.
ICTWays workshop “Creativity and imagination in the classroom: Arduino and its application samples” LLP PT-COMENIUS-CNW
Session 6 John Wolf (WolfDenElectronics.com). Objectives – We’ll Learn  Code to Voice  PIR sensors – motion detection  Quadrature Encoders  Audio.
Ultrasonic Sensor TYWu.
Pulse Width Modulation Instructor Dr Matthew Khi Yi Kyaw.
Hacking on Arduino George Patterson
physical computing .2 – Day 3
Lab 7 Basic 1: Game of Memory
Sparkfun Electronics ATtiny85 Arduino Quick Reference Sheet
Assist. Prof. Rassim Suliyev - SDU 2017
Assist. Prof. Rassim Suliyev - SDU 2017
Manual for Arduino Kit v1.0
MediaLive 2012 Danger Shield, Arduino and Processing
Wireless Cue Light Project
Arduino & its hardware interfacing
Microcontroller basics
Tele-presence – Connecting Two Processing Platforms via Internet
Arduino Part 1 Topics: Microcontrollers Programming Basics
INC 161 , CPE 100 Computer Programming
CU ATLAS Practical electronics MIDI and Arduino
Arduino Uno and sensors
3.2 Serial Communication Part 2
3.1 Serial Communication Part 1
Topics: Analog/Digital Read Relay control 7 segment control Buzzer
IoT Programming the Particle Photon.
Programming, Serial and Virtual Prototyping
Intro to the Arduino Topics: The Arduino Digital IO
Arduino Week 2 Lab ECE 1020 Prof. Ahmadi.
Programming 2: The Arduino IDE & First Sketches
Stringler.
Appliace Remote Control
Arduino UMBC IEEE Sekar Kulandaivel
Presentation transcript:

Serial Communication

mouseX from computer to arduino processing sends a single byte of data arduino reads each byte arduino uses value to set light brightness Processing In the definitions import processing.serial.*; Serial port; In the setup println("Available serial ports:"); println(Serial.list()); port = new Serial(this, Serial.list()[0], 9600); In the draw port.write(mouseX); Arduino In the setup Serial.begin(9600); In the loop byte brightness; if (Serial.available()) { brightness = Serial.read(); analogWrite(ledPin, brightness); }

keystrokes from computer to arduino processing sends a single letter arduino reads and checks the letter arduino uses value as switch for light Processing In the definitions import processing.serial.*; Serial port; In the setup println("Available serial ports:"); println(Serial.list()); port = new Serial(this, Serial.list()[0], 9600); In the draw If…. {port.write(‘H’);} else…. {port.write(‘L’);} Arduino In the setup Serial.begin(9600); In the loop int inLetter; if (Serial.available()) { inLetter = Serial.read(); If (inLetter == ‘H’){ digitalWrite(ledPin, HIGH);} }

single data byte from arduino to computer arduino sends a single byte from sensor processing stores the byte processing uses value to draw line length Processing In the definitions import processing.serial.*; Serial port; In the setup println("Available serial ports:"); println(Serial.list()); port = new Serial(this, Serial.list()[0], 9600); In the draw - NOTHING void serialEvent (Serial port) { int inByte = port.read(); line(graphXPos, height, graphXPos, height - inByte); } Arduino In the setup Serial.begin(9600); In the loop val = analogRead(sensorPin); val = val/4; Serial.print(val, BYTE);

Processing In the definitions import processing.serial.*; Serial port; In the setup println("Available serial ports:"); println(Serial.list()); port = new Serial(this, Serial.list()[0], 9600); port.bufferUntil('\n'); void serialEvent (Serial port) String inString = port.readStringUntil('\n'); if (inString != null) { inString = trim(inString); float inByte = float(inString); inByte = map(inByte, 0, 1023, 0, height); line(xPos, height, xPos, height - inByte); Arduino In the setup Serial.begin(9600); In the loop Serial.println(analogRead(0)); single data string from arduino to computer arduino sends data from sensor processing reads data up to new line, cleans, stores data processing uses value to draw line length

Processing import processing.serial.*; Serial myPort; void setup() { myPort = new Serial(this, Serial.list()[0], 9600); myPort.bufferUntil('\n'); } void draw() { fill(fgcolor); ellipse(xpos, ypos, 20, 20); } void serialEvent(Serial myPort) { String myString = myPort.readStringUntil('\n'); if (myString != null) { myString = trim(myString); int sensors[] = int(split(myString, ',')); if (sensors.length > 1) { xpos = map(sensors[0], 0,1023,0,width); ypos = map(sensors[1], 0,1023,0,height); fgcolor = sensors[2] * 255; }}} Arduino In the setup Serial.begin(9600); In the loop sensorValue = analogRead(analogOne); Serial.print(sensorValue, DEC); Serial.print(","); sensorValue = analogRead(analogTwo); Serial.print(sensorValue, DEC); Serial.print(","); sensorValue = digitalRead(digitalOne); Serial.println(sensorValue, DEC); multiple data strings from arduino to computer arduino sends data from sensor processing reads data up to new line, splits, cleans, stores data processing uses value to draw line length

two options Punctuation or Call and response

firmata read and write to arduino sensors and actuators directly from processing (download and add firmata folder to arduino/hardware/Iibraries) load firmata to the arduino via usb download and add arduino folder to processing/libraries make read and write calls to the arduino from processing

data Internet data - use xml library

rfid Arduino serial RX to Parallax TX Arduino GND to Parallax GND Arduino digital pin (i.e. #2) to Parallax /ENABLE Arduino +5V to Parallax Vcc

Wireless set up xbee parameters in zterm

midi three pieces of information sent in midi message: the action (note on, note off, pitch bend, etc.) the pitch (plain old musical pitch) the velocity (basically, how loud you want the sound to play)

extras lilly pad Wii controller arduino-class-notes-3-4/