14
Es werde Licht mit Arduino Yes, we scan… http://en.wikipedia.org/wiki/Web_of_Things Max Kleiner Script: 510_bonn_gpsdata_mX4.pas

Arduino delphi 2014_7_bonn

Embed Size (px)

DESCRIPTION

Serial Interfaces with Arduino and a Socket Server

Citation preview

Page 1: Arduino delphi 2014_7_bonn

Es werde Licht mit Arduino

Yes, we scan…http://en.wikipedia.org/wiki/Web_of_Things

Max Kleiner

Script: 510_bonn_gpsdata_mX4.pas

Page 2: Arduino delphi 2014_7_bonn

World of Things are changing

(Web of Things)

2

• You deal with physics and elements (xyz)• Lots of sensors & actuators to solder• Memory/energy on ucontroller is very small• Which Casing…, ex. 336_digiclock_3.txt• Push a Session or pull a Service ?• Call it Client to Device Ident (CD Host)• Which Use Case ex. App or DigiCam?

http://en.wikipedia.org/wiki/Anti-pattern

A Short History of Time 1991 Application Program1995 Application1998 Applet2010 App2015 A (Android, Arduino, ARM)

Page 3: Arduino delphi 2014_7_bonn

Some Theory and Practise• Digital World is build on Analogue World•••••

3070_pas_functionplotter_digital2.txt

Page 4: Arduino delphi 2014_7_bonn

How to Start ?

• With a Starter Kit you have everything you need to start learning the basics of electronics: an Arduino UNO, an essential set for wiring things up, a lot of sensors and actuators.

4Ex. 488_AsyncTerminal2.txt Blink (out of the Box)

Page 5: Arduino delphi 2014_7_bonn

Need Things

RS 232 TSerial, AsyncPro, CPort

OscilloscopeBoard & LEDEditors

5

Page 6: Arduino delphi 2014_7_bonn

Proof of Concept Lord of the Things

6

Page 7: Arduino delphi 2014_7_bonn

Case Study LED Box Solution

7

Arduino UNO MemoryFlash 32,768 bytes non-volatile Stores the program source code and Arduino bootloaderSRAM 2048 bytes volatile Operating space for accessing variables and functionsEEPROM 1024 bytes non-volatile Permanent storage for user data like readings or settings

Page 8: Arduino delphi 2014_7_bonn

Use Case Shine on you crazy…

8Send a command over http to COM on board to light a RGB led

Page 9: Arduino delphi 2014_7_bonn

Solution Arduino C

9

Tutor: http://www.softwareschule.ch/download/maxbox_starter18_3.pdf

void setup() { // initialize digital pin as an output. pinMode(ledPin11, OUTPUT); Serial.begin(9600);

void loop () { val = Serial.read(); //read serial port if (val !=-1){ if (val=='1'){ digitalWrite(ledPin1,HIGH); } else if (val=='A'){ digitalWrite(ledPin1,LOW); }

Standard Arduino Library

Page 10: Arduino delphi 2014_7_bonn

Solution HTTP Server

10

http://www.softwareschule.ch/examples/443_webserver_arduino_rgb_light4.txt

76 with HTTPServer do begin77 if Active then Free;78 if not Active then begin79 bindings.Clear;80 bindings.Add;81 bindings.items[0].Port:= APORT;82 bindings.items[0].IP:= IPADDR; //'127.0.0.1'; {GetHostIP}83 Active:= true;84 onCommandGet:= @HTTPServerGet;85 PrintF('Listening HTTP on %s:%d.', [Bindings[0].IP,Bindings[0].Port]);86 end;

Page 11: Arduino delphi 2014_7_bonn

Solution COM Port

11

361_heartbeat_wave.txthttp://en.wikipedia.org/wiki/Household_appliances

54 if uppercase(localcom) = uppercase('/LED') then begin55 cPort.WriteStr('1')56 writeln(localcom+ ': LED on');57 RespInfo.ContentText:= getHTMLContentString('LED is: ON');58 end else59 if uppercase(localcom) = uppercase('/DEL') then begin60 cPort.WriteStr('A');61 writeln(localcom+ ': LED off');62 RespInfo.ContentText:= getHTMLContentString('LED is: OFF')63 end;

procedure HTTPServerGet(aThr: TIdPeerThread; reqInfo: TIdHTTPRequestInfo; respInfo: TIdHTTPResponseInfo);

Page 12: Arduino delphi 2014_7_bonn

Test the Light http://192.168.1.40:8080/R

12

Ein Spermium enthält 37,5 MB DNA-Daten. Eine Ejakulation entspricht einem Datentransfer von 1500 TB in 3 Sek. Und ihr denkt DSL sei schnell... ;).

Page 13: Arduino delphi 2014_7_bonn

Thanks! Links to Rightsthe source is the code

13

http://www.softwareschule.ch/maxbox.htmhttp://sourceforge.net/projects/maxboxhttp://sourceforge.net/apps/mediawiki/maxbox/http://en.wikipedia.org/wiki/Arduinohttp://www.softwareschule.ch/download/webofthings2013.pdf

Book Patterns konkrethttp://www.amazon.de/Patterns-konkret-Max-Kleiner/dp/3935042469

maXboxhttps://github.com/maxkleiner/maXbox3/releases

Page 14: Arduino delphi 2014_7_bonn

Questions? Code a Worldhack the earth

14

Yes, we hack…https://github.com/maxkleiner/maXbox3/releases