Connecting RIAs and hardware together

Post on 27-Jan-2015

119 views 0 download

Tags:

description

This session looks at the revolution in low cost, easy to program embedded computing and connecting it to the internet. Focusing on the Arduino open source hardware and software platform and how it can be easily connected to various RIA platforms – directly, via the ethernet or via the cloud. Topics covered range from digital and analogue input and output to creating your own Arduino web server (in under 20 lines of code). Show that it's easier than you realise to interface with hardware and that with a little knowledge you can do this.

Transcript of Connecting RIAs and hardware together

Justin Mclean, Class Software

Flex and the Arduino platform

Connecting Hardware toRich Internet Applications

Tuesday, 1 June 2010

Who am I?

Director of Class Software for 10 + yearsDeveloping and creating web applications for 15

yearsProgramming for 25 yearsAdobe community professional in FlexAdobe certified developer and trainer in ColdFusion

and FlexBased in Sydney Australia

Tuesday, 1 June 2010

Electronics Trends

Low cost componentsSmall componentsComplex components with simple standard interfaces

Tuesday, 1 June 2010

Computing Trends

Easier to programUse of high level languagesSoftware toolsOpen source

Tuesday, 1 June 2010

Are We There Yet?

Low cost fast devicesIt’s easy to communicate between devices and

computersCan build complex systems from off the shelf

components

Tuesday, 1 June 2010

Arduino

Overview of the Arduino Platform

Tuesday, 1 June 2010

Arduino Platform

Open source hardware and software platformEasy to programHardware is flexible, fast, low power and low cost

Tuesday, 1 June 2010

Arduino Hardware

Comes in a number of shapes sizesLow costEasy to extendDigital inputs/outputsAnalog inputs

Tuesday, 1 June 2010

Arduino Boards

Tuesday, 1 June 2010

Arduino Boards

Tuesday, 1 June 2010

Arduino Boards

Tuesday, 1 June 2010

Arduino Boards

Tuesday, 1 June 2010

Arduino Shields

Tuesday, 1 June 2010

Arduino Shields

Tuesday, 1 June 2010

Arduino Shields

Tuesday, 1 June 2010

Arduino Shields

Tuesday, 1 June 2010

Arduino Software Platform

Open source cross platform IDEAlpha but very stableUpdated frequentlyGrowing and active community

Tuesday, 1 June 2010

Arduino Code

C like high level languageInbuilt functions to read and set digital and analog

inputs and outputsIncludes libraries to perform common hardware or

software tasksOnce uploaded programs are permanent

Tuesday, 1 June 2010

Arduino IDE

Tuesday, 1 June 2010

Led Shield Demo

Tuesday, 1 June 2010

Led Shield Demo

Tuesday, 1 June 2010

Issues

Debugging can be hardNo simulatorMemory, power and speed limits Helps to have a little electronics knowledge

Tuesday, 1 June 2010

How Arduinos can communicate with the world

Connecting Arduinos to the Web

Tuesday, 1 June 2010

Connection Methods

Direct to computer (USB)Wireless (XBee modems)Ethernet or WiFi“The Cloud”

Tuesday, 1 June 2010

Supported Languages

Flash and FlexProcessingPythonRubyJavaC, C++, C# and Objective C.NET

Tuesday, 1 June 2010

Flex

Flex to Arduino direct connection

Tuesday, 1 June 2010

Layers of Communication

Flex to proxy via an Actionscript libraryProxy to USB communicationUSB to arduino

Tuesday, 1 June 2010

Flex to Arduino

USB Proxy FirmataAS3 Glue

Flex Code Arduino

USBCable

TCP/IPSocket

Computer Arduino

Function Calls and Events

Code

Tuesday, 1 June 2010

Flex Led Demo

Tuesday, 1 June 2010

AS3Glue Digital Output

Create arduino instancevar arduino:Arduino = new Arduino();

Wait for firmware versionSet digital pin as output

arduino.setPinMode(pin, Arduino.OUTPUT);Turn digital output on

arduino.writeDigitalPin(pin, Arduino.HIGH);

Tuesday, 1 June 2010

Danger Shield Demo

Tuesday, 1 June 2010

AS3Glue Analog Input

Turn on analog reportingarduino.setAnalogPinReporting(pin, Arduino.ON);Listen for changes via event listener

arduino.addEventListener(ArduinoEvent.ANALOG_DATA, onReceiveData);

public function onReceiveData(event:ArduinoEvent):void { ....}

Tuesday, 1 June 2010

Ethernet

Using Arduino Ethernet Shields

Tuesday, 1 June 2010

Ethernet Shields

Allow direct internet connectionNo dedicated PC neededShields need a little configCan act as web server or client

Tuesday, 1 June 2010

Ethernet Shields

Tuesday, 1 June 2010

Ethernet Shields

Tuesday, 1 June 2010

Ethernet Shields

Tuesday, 1 June 2010

Web Servers

Simpler than you thinkA web server:

Listens for connectionsParse requestsSend back status messages/resources requested

Tuesday, 1 June 2010

HTTP Requests

Start with request “GET index.html HTTP/1.1”Optional headers “Accept-Language: en”Empty lineOptional message body (POST and other requests)

Tuesday, 1 June 2010

Web server codeEasy to modify

Ethernet Arduino Code

Tuesday, 1 June 2010

Ethernet Demo

Tuesday, 1 June 2010

Rich Internet Applications

Ideas on how and where to use this technology

Tuesday, 1 June 2010

Environmental Monitoring

Indoors or outdoorsWide range of sensorsSleep mode/low power consumption

Tuesday, 1 June 2010

Home Automation

Power and utilities monitoringControlling Lights and Heating/CoolingGarden watering/monitoring

Tuesday, 1 June 2010

Security and Safety

Security systemsLocation reportingBike jackets

Tuesday, 1 June 2010

Why do this?

Expose yourself to new ideas and new ways of solving problems

Involves interaction with the real worldEncourages creativityMakes you a better programmer

Tuesday, 1 June 2010

It’s Fun!

Tuesday, 1 June 2010

Questions?

Ask now, see me after session or email justin@classsoftware.com

Slides and code can be found athttp://blog.classsoftware.com/

Tuesday, 1 June 2010

Useful Sites

List of useful hardware and software sites

Tuesday, 1 June 2010

Software Sites

Arduino http://www.arduino.cc for software, user forum and playground

Ethernet Shields http://arduino.cc/en/Reference/Ethernet

Pachhub http://www.pachube.com/

Tuesday, 1 June 2010

Hardware Sites

Spark Fun (US) http://www.sparcfun.com/Adafruit Industries (US) http://www.adafruit.com/Electronic Goldmine (US) http://www.goldmine-

elec.com/

Tuesday, 1 June 2010

Other Sites

Lady Ada http://www.ladyada.com/Evil Mad Scientist http://www.evilmadscientist.com/NY Resistor http://www.nycresistor.com/Make Zine http://www.makezine.com/

Tuesday, 1 June 2010