aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--code/001-blink.js4
-rw-r--r--code/002-button.js4
-rw-r--r--code/003-dht22.js5
-rw-r--r--code/004-display.js11
-rw-r--r--slides/img/dht22.pngbin0 -> 29904 bytes
-rw-r--r--slides/img/display.pngbin0 -> 38825 bytes
-rw-r--r--slides/img/function.pngbin0 -> 31435 bytes
-rw-r--r--slides/presentazione_espruino.rst19
8 files changed, 37 insertions, 6 deletions
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
--- /dev/null
+++ b/slides/img/dht22.png
Binary files differ
diff --git a/slides/img/display.png b/slides/img/display.png
new file mode 100644
index 0000000..8627e0c
--- /dev/null
+++ b/slides/img/display.png
Binary files differ
diff --git a/slides/img/function.png b/slides/img/function.png
new file mode 100644
index 0000000..8fe8f22
--- /dev/null
+++ b/slides/img/function.png
Binary files 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?
--------