Arduino Platform Part II Justin Mclean Class Software Email: - - PowerPoint PPT Presentation

arduino platform part ii
SMART_READER_LITE
LIVE PREVIEW

Arduino Platform Part II Justin Mclean Class Software Email: - - PowerPoint PPT Presentation

Arduino Platform Part II Justin Mclean Class Software Email: justin@classsoftware.com Twitter: @justinmclean Blog: http://blog.classsoftware.com Wednesday, 1 June 2011 Who am I? Director of Class Software for almost 15 years


slide-1
SLIDE 1

Arduino Platform Part II

Justin Mclean Class Software

Email: justin@classsoftware.com Twitter: @justinmclean Blog: http://blog.classsoftware.com

Wednesday, 1 June 2011

slide-2
SLIDE 2

Who am I?

  • Director of Class Software for almost 15 years
  • Developing and creating web applications for

15 years

  • Programming for 25 years
  • Adobe certified developer and trainer in Flex

and ColdFusion

  • Adobe Community Champion
  • Based in Sydney Australia

Wednesday, 1 June 2011

slide-3
SLIDE 3

Arduino

Review of last session

Wednesday, 1 June 2011

slide-4
SLIDE 4

Arduino

  • Open source hardware and software platform
  • Free software
  • Easy to program
  • Low cost hardware
  • Several physical form factors

Wednesday, 1 June 2011

slide-5
SLIDE 5

Shields

  • Plug on top of Arduino
  • Many available
  • Can make your own
  • Can be stacked

Wednesday, 1 June 2011

slide-6
SLIDE 6

Led Shield Demo

Wednesday, 1 June 2011

slide-7
SLIDE 7

Led Shield Demo

Wednesday, 1 June 2011

slide-8
SLIDE 8

Programming

  • C/C++ language based on wiring
  • GCC under the hood
  • Write code and compile in IDE
  • Upload compiled code via USB
  • Can monitor serial port
  • Uploaded program is in non volatile memory
  • Setup and Loop functions

Wednesday, 1 June 2011

slide-9
SLIDE 9

Digital Inputs/Outputs

  • Digital pins on Arduino are dual purpose
  • Digital logic and voltage on = 5V off = 0V
  • Can be set to be input or output via pinMode

Wednesday, 1 June 2011

slide-10
SLIDE 10

Debugging via Serial Port

  • Use Serial.begin to set speed
  • Use Serial.print or Serial.println to output
  • Use serial monitor in IDE to view

Wednesday, 1 June 2011

slide-11
SLIDE 11

Reading Inputs

  • Can read values via analogRead
  • Result is in range 0 to 1023 (10 bits)
  • 0V = 0 and 5V =1023

Wednesday, 1 June 2011

slide-12
SLIDE 12

Flex

Communication between Flex and Arduino

Wednesday, 1 June 2011

slide-13
SLIDE 13

Flex Communication

  • Software on Arduino (Firmata)
  • USB serial to socket proxy
  • Flex event based library to talk to socket

(as3Glue)

Wednesday, 1 June 2011

slide-14
SLIDE 14

USB Proxy Firmata AS3 Glue Flex Code Arduino

USB Cable TCP/IP Socket Computer Arduino Function Calls and Events Code

Flex Communications

Wednesday, 1 June 2011

slide-15
SLIDE 15

Firmata

  • Arduino library
  • Binary protocol over serial interface
  • Bi-directional
  • Can use standard program or write your own
  • Extendable

Wednesday, 1 June 2011

slide-16
SLIDE 16

Standard Firmata

  • Open Firmata
  • Compile and upload to Arduino

Wednesday, 1 June 2011

slide-17
SLIDE 17

USB Proxy

  • USB socket proxy - Serproxy
  • Configuration file (serproxy.cfg)
  • Communicates between Arduino and Flex

Wednesday, 1 June 2011

slide-18
SLIDE 18

Flex Socket Library

  • as3Glue library
  • API to set digital outputs and reporting
  • Communicates via TCP/IP socket interface
  • Receive events on change of digital inputs and

analogue inputs

Wednesday, 1 June 2011

slide-19
SLIDE 19

Review of Flex Events

  • Listening for events
  • Event handlers
  • Event bubbling

Wednesday, 1 June 2011

slide-20
SLIDE 20

as3Glue Library

  • Arduino class
  • To set values call getDigitalData and

getAnalogData

  • To read values:
  • Turn on pin reporting
  • Listen for ANALOG_DATA or

DIGITAL_DATA events

Wednesday, 1 June 2011

slide-21
SLIDE 21

Flex Digital Outputs

  • Open Flex IDE and create new project
  • Add glue library
  • Create a button that turns on digital output 3

Wednesday, 1 June 2011

slide-22
SLIDE 22

LED Circuit

Wednesday, 1 June 2011

slide-23
SLIDE 23

LED Circuit

Wednesday, 1 June 2011

slide-24
SLIDE 24

Flex Analogue Inputs

  • Use LDR to set brightness of LED

Wednesday, 1 June 2011

slide-25
SLIDE 25

LDR Circuit

Wednesday, 1 June 2011

slide-26
SLIDE 26

LDR Circuit

Wednesday, 1 June 2011

slide-27
SLIDE 27

Web Servers

Turning an Arduino into a web server

Wednesday, 1 June 2011

slide-28
SLIDE 28

LDR Circuit

Wednesday, 1 June 2011

slide-29
SLIDE 29

Analogue Values Flex

  • Use HTTPService to set up call to web server

(result type needs to be e4x)

  • Use Timer to make HTTP request
  • Graph values

Wednesday, 1 June 2011

slide-30
SLIDE 30

Sending Data

  • Need to parse GET command
  • Buffered vs character at a time parsing
  • Need to handle or ignore bad input

Wednesday, 1 June 2011

slide-31
SLIDE 31

RGB LED Circuit

Wednesday, 1 June 2011

slide-32
SLIDE 32

Digital Output Flex

  • Use HTTPService to set up call to web server

(result type needs to be e4x)

  • Create parameter object to send
  • Check XML results

Wednesday, 1 June 2011

slide-33
SLIDE 33

Resources

Finding out more information

Wednesday, 1 June 2011

slide-34
SLIDE 34

Arduino Sites

  • Ardunio (http://ardunio.cc)
  • Tinker It! (http://tinker.it)
  • Lady Ada (http://ladyada.net)
  • Seeed Studio (http://www.seeedstudio.com)
  • Modern Device (http://moderndevice.com)

Wednesday, 1 June 2011

slide-35
SLIDE 35

Electronic Components Suppliers

  • Spark fun (http://www.sparkfun.com)
  • Electric Goldmine (http://www.goldmine-elec-

products.com/)

  • Digikey (http://www.digikey.com/)
  • Farnell (http://ww.farnell.com/)

Wednesday, 1 June 2011

slide-36
SLIDE 36

Other Sites

  • Make magazine (http://makezine.com/)
  • Evil Mad Scientist (http://

evilmadscientist.com)

  • NYC Resistor (http://nycresistor.com)

Wednesday, 1 June 2011