Slide 1

Slide 1 text

Espruino Espruino JavaScript for Things JavaScript for Things Niko Köbler ( ) @dasniko {JavaScript}Training

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

JavaScript JavaScript as the as the Language Language of the of the Web! Web!

Slide 5

Slide 5 text

Write once, Write once, run everywhere! run everywhere! It is already used everywhere!

Slide 6

Slide 6 text

Clients Clients Desktops, Laptops, Smartphones, Tablets, TVs, etc.

Slide 7

Slide 7 text

Servers Servers etc.

Slide 8

Slide 8 text

Microcontollers & USB-Sticks And now: And now:

Slide 9

Slide 9 text

Espruino Project Espruino Project Founder: Gordon Williams ( ), UK @espruino www.espruino.com Open Source Hardware (CC-BY-SA) Open Source Software (MPLv2)

Slide 10

Slide 10 text

Crowdfunded on Kickstarter! Crowdfunded on Kickstarter! Espruino Espruino Goal: 20k GBP, Pledged: 100k GBP by 1.692 backers in September 2013 Pico Pico Goal: 15k GBP, Pledged: 75k GBP by 1.448 backers in November 2014

Slide 11

Slide 11 text

The Board The Board 54 x 41 mm (half of business card!) STM32F1 chip family

Slide 12

Slide 12 text

The STM32 Chip The STM32 Chip STM32F103RCT6 32-bit, 72MHz 256kB Flash Memory 48kB RAM Only 1 Chip, therefore less power consumption! (this is kind of "green IT")

Slide 13

Slide 13 text

GPIOs GPIOs

Slide 14

Slide 14 text

Board-Features Board-Features Battery Connector Micro-USB Connector SD-Card Slot Bluetooth Pads Prototyping-Area 2 Buttons, 3 LEDs

Slide 15

Slide 15 text

The Pico The Pico STM32F401C chip, 384kB Flash, 96kB RAM less (22) GPIOs than Espruino Board USB powered

Slide 16

Slide 16 text

The Interpreter The Interpreter Because JavaScript is interpreted, the code can be changed while it is running! You don't have to compile/install anything anymore. No deployment-cycles, faster delivery! Instant feedback on every code/function execution: good (ok) / bad (error)

Slide 17

Slide 17 text

Event-based Model Event-based Model Evented I/O like Node.js, Vert.x, Play, Akka and other popular approaches. (even NPM modules can be used!) More interactive and understandable, because it's the way people naturally describe tasks: "When it's dark, turn on the light." Code is only processed on events and if necessary, this saves energy!

Slide 18

Slide 18 text

Power Saving Power Saving The interpreter knows when it can go to sleep, and how deeply. Even the WiFi module doesn't need power while sleeping! Example: Example: LED-flashing with a 700mAh Li-Ion battery: Raspberry PI: 1 - 2 hours Arduino: 1 - 2 days Espruino: ~6 months

Slide 19

Slide 19 text

Documentation Documentation www.espruino.com 1. 2. 3. Reference Modules Tutorials

Slide 20

Slide 20 text

Getting Startet Getting Startet http://www.espruino.com/Quick+Start

Slide 21

Slide 21 text

Web IDE (Chrome App) Web IDE (Chrome App)

Slide 22

Slide 22 text

Example 1: Toggle LED Example 1: Toggle LED digitalWrite(LED1,1); digitalWrite(LED1,0); function toggle() { on = !on; digitalWrite(LED1, on); }; toggle(); var interval = setInterval(toggle, 500); clearInterval(interval);

Slide 23

Slide 23 text

Example 2: Example 2: Switch LEDs with Button Switch LEDs with Button LED1.set(); LED1.reset(); setWatch(function () { LED1.set(); setTimeout("LED1.reset(); LED2.set();", 500); setTimeout("LED2.reset(); LED3.set();", 1000); setTimeout("LED3.reset()", 1500); }, BTN, { repeat : true, edge : "rising" }); Video: http://youtu.be/Ts8K07VhzIM

Slide 24

Slide 24 text

Create HTTP server via Wifi module and test on startup if wireless connection can be established. Example 3: HTTP-Server Example 3: HTTP-Server var wlan = require("CC3000").connect(); var http = require("http"); wlan.connect("mySSID", "mySecret", function (s) { if (s == "dhcp") { console.log("My IP is " + wlan.getIP().ip); http.get("http://www.pur3.co.uk/hello.txt", function(res) { res.on('data', function(data) { console.log(">" + data); }); }); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.write('Hello World'); res.end(); }).listen(80); } }); (CC3000)

Slide 25

Slide 25 text

Where to next? Where to next?

Slide 26

Slide 26 text

Sensor Networks Sensor Networks small form-factor low energy consumption (needs energy only when doing something, not while sleeping) MQTT + socket support HTTP support already built-in!

Slide 27

Slide 27 text

USB HID support USB HID support Allowing Espruino (Pico) to act like a USB keyboard, mouse or joystick. Make your own input devices for you PC, or make Espruino "play back" a series of keypresses. http://forum.espruino.com/conversations/127079/

Slide 28

Slide 28 text

"Programming" with Audio "Programming" with Audio http://forum.espruino.com/conversations/257732/

Slide 29

Slide 29 text

TV-Output TV-Output http://forum.espruino.com/conversations/259768/

Slide 30

Slide 30 text

Thank you! Thank you! Questions? Questions? Contact: Contact: @dasniko @dasniko Slides: http://slides.com/dasniko/espruino