From 6cb056f979f20e895930940c94b05767d081dd61 Mon Sep 17 00:00:00 2001 From: Elena ``of Valhalla'' Grandi Date: Thu, 23 Feb 2017 22:11:21 +0100 Subject: Some additional slides --- code/001-blink.js | 4 ++-- code/002-button.js | 4 ++-- code/003-dht22.js | 5 +++++ code/004-display.js | 11 +++++++++++ slides/img/dht22.png | Bin 0 -> 29904 bytes slides/img/display.png | Bin 0 -> 38825 bytes slides/img/function.png | Bin 0 -> 31435 bytes slides/presentazione_espruino.rst | 19 +++++++++++++++++-- 8 files changed, 37 insertions(+), 6 deletions(-) create mode 100644 code/003-dht22.js create mode 100644 code/004-display.js create mode 100644 slides/img/dht22.png create mode 100644 slides/img/display.png create mode 100644 slides/img/function.png diff --git a/code/001-blink.js b/code/001-blink.js index 408aeb4..7e4926d 100644 --- a/code/001-blink.js +++ b/code/001-blink.js @@ -1,5 +1,5 @@ -var on = false; +var on = false; setInterval(function() { on = !on; LED1.write(on); -}, 500); \ No newline at end of file +}, 500); diff --git a/code/002-button.js b/code/002-button.js index e98ace2..7fff372 100644 --- a/code/002-button.js +++ b/code/002-button.js @@ -1,7 +1,7 @@ -var on = false; +var on = false; var change = function() { on = !on; LED1.write(on); }; -setWatch(change, BTN1, {repeat:true, edge:"rising"}); \ No newline at end of file +setWatch(change, BTN1, {repeat:true, edge:"rising"}); diff --git a/code/003-dht22.js b/code/003-dht22.js new file mode 100644 index 0000000..c925120 --- /dev/null +++ b/code/003-dht22.js @@ -0,0 +1,5 @@ +var dht = require("DHT22").connect(C11); + +dht.read(function (data) { + console.log("Temp is "+data.temp.toString()+" and RH is "+data.rh.toString()); +}); \ No newline at end of file diff --git a/code/004-display.js b/code/004-display.js new file mode 100644 index 0000000..e7b4cd1 --- /dev/null +++ b/code/004-display.js @@ -0,0 +1,11 @@ +var dht = require("DHT22").connect(C11); + +I2C1.setup({scl:B6,sda:B7}); +var g = require("SH1106").connect(I2C1, start); + +dht.read(function (data) { + console.log("Read DHT22"); + g.drawString("Temp: "+data.temp.toString(),2,2); + g.drawString(" RH: "+data.rh.toString(),2,10); + g.flip(); +}); \ No newline at end of file diff --git a/slides/img/dht22.png b/slides/img/dht22.png new file mode 100644 index 0000000..4db9c28 Binary files /dev/null and b/slides/img/dht22.png differ diff --git a/slides/img/display.png b/slides/img/display.png new file mode 100644 index 0000000..8627e0c Binary files /dev/null and b/slides/img/display.png differ diff --git a/slides/img/function.png b/slides/img/function.png new file mode 100644 index 0000000..8fe8f22 Binary files /dev/null and b/slides/img/function.png differ diff --git a/slides/presentazione_espruino.rst b/slides/presentazione_espruino.rst index cd23619..ca5f429 100644 --- a/slides/presentazione_espruino.rst +++ b/slides/presentazione_espruino.rst @@ -124,8 +124,23 @@ Bottoni .. image:: img/button.png :align: center -Basi di javascript ------------------- +Funzioni +-------- + +.. image:: img/function.png + :align: center + +DHT22 +----- + +.. image:: img/dht22.png + :align: center + +OLED +---- + +.. image:: img/display.png + :align: center Domande? -------- -- cgit v1.2.3