Monsters, brievenbussen en andere onzin @ Amsterdam University of Applied Sciences

Monsters, brievenbussen en andere onzin @ Amsterdam University of Applied Sciences

Monsters, mailboxes and other non-sense. A talk about about combining sensors, switches and displays with different technologies to solve problems that don't really exist and more importantly just to have fun with IoT and make geeky stuff. This talk contains monsters, and lots of them.

De023a9aff4c7a5ede3a81e8c76f17b5?s=128

Niels Leenheer

April 11, 2017
Tweet

Transcript

  1. 2.
  2. 3.
  3. 5.
  4. 6.
  5. 9.
  6. 11.
  7. 12.
  8. 13.
  9. 14.
  10. 15.
  11. 17.

    afstand mesh rechtstreeks 2-weg standaard ̣ ✔ ✔ ✔ ̣̣

    ✱ ✔ ✔ ✔ 433 MHz ̣̣̣ ✱ ̣̣̣̣ ✔ ✔ ✱ ̣̣̣̣ ✔ ✔ ✔
  12. 19.
  13. 20.
  14. 22.
  15. 27.
  16. 28.
  17. 32.
  18. 34.
  19. 41.
  20. 43.

    #include <Adafruit_NeoPixel.h> #define PIN D1 #define PIXELS 24 Adafruit_NeoPixel strip

    = Adafruit_NeoPixel(PIXELS, PIN, NEO_GRB + NEO_KHZ800); void setup(void) { strip.begin(); strip.setBrightness(255); strip.setPixelColor(0, strip.Color(0, 0, 255)); strip.show(); } void loop(void) { }
  21. 44.

    int i = 0; void setup(void) { strip.begin(); strip.setBrightness(255); }

    void loop(void) { i = (i + 1) % PIXELS; strip.setPixelColor(i % PIXELS, strip.Color(0, 0, 0)); strip.setPixelColor((i + 1) % PIXELS, strip.Color(0, 0, 63)); strip.setPixelColor((i + 2) % PIXELS, strip.Color(0, 0, 127)); strip.setPixelColor((i + 3) % PIXELS, strip.Color(0, 0, 195)); strip.setPixelColor((i + 4) % PIXELS, strip.Color(0, 0, 255)); strip.show(); delay(8); }
  22. 47.
  23. 48.
  24. 49.
  25. 50.
  26. 52.

    const char* ssid = "........"; const char* password = "........";

    ESP8266WebServer server(80); void setup(void) { WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) delay(500); server.on("/on", [](){ server.send(200, "text/plain", "on"); }); server.on("/off", [](){ server.send(200, "text/plain", "off"); }); server.begin(); } void loop(void) { server.handleClient(); }
  27. 55.
  28. 58.
  29. 60.
  30. 62.
  31. 63.
  32. 64.
  33. 65.
  34. 69.
  35. 70.

    editor.addEventListener('touchstart', handleTouch); editor.addEventListener('touchmove', handleTouch); function handleTouch(e) { for (var i

    = 0; i < e.changedTouches.length; i++) { let elem = document.elementFromPoint( e.changedTouches[i].pageX, e.changedTouches[i].pageY ); if (elem.tagName && elem.tagName == 'TD' && 
 editor.contains(elem)) 
 { drawPixel(elem); } } e.preventDefault(); }
  36. 71.

    editor.addEventListener('touchstart', handleTouch); editor.addEventListener('touchmove', handleTouch); function handleTouch(e) { for (var i

    = 0; i < e.changedTouches.length; i++) { let elem = document.elementFromPoint( e.changedTouches[i].pageX, e.changedTouches[i].pageY ); if (elem.tagName && elem.tagName == 'TD' && 
 editor.contains(elem)) 
 { drawPixel(elem); } } e.preventDefault(); }
  37. 72.

    let socket = new WebSocket( "ws://" + window.location.host + "/ws"

    ); function drawPixel(elem) { if (elem.dataset.color != currentColor) { elem.dataset.color = currentColor; elem.style.backgroundColor = '#' + currentColor; socket.send(JSON.stringify({ command: "draw", x: elem.dataset.x, y: elem.dataset.y, color: currentColor })); } }
  38. 73.

    let socket = new WebSocket( "ws://" + window.location.host + "/ws"

    ); function drawPixel(elem) { if (elem.dataset.color != currentColor) { elem.dataset.color = currentColor; elem.style.backgroundColor = '#' + currentColor; socket.send(JSON.stringify({ command: "draw", x: elem.dataset.x, y: elem.dataset.y, color: currentColor })); } }
  39. 76.
  40. 77.
  41. 78.

    socket.onmessage = function(msg) { let data = JSON.parse(msg.data); if (data.command

    == "draw") { let elem = document.querySelector( 'td[data-x=' + data.x + ']' + 
 '[data-y=' + data.y + ']' ); elem.dataset.color = data.color; elem.style.backgroundColor = '#' + data.color }; } }
  42. 79.

    socket.onmessage = function(msg) { let data = JSON.parse(msg.data); if (data.command

    == "draw") { let elem = document.querySelector( 'td[data-x=' + data.x + ']' + 
 '[data-y=' + data.y + ']' ); elem.dataset.color = data.color; elem.style.backgroundColor = '#' + data.color }; } }
  43. 80.
  44. 86.
  45. 87.
  46. 88.
  47. 93.
  48. 94.
  49. 96.
  50. 98.

    De was is klaar! De was is klaar! De was

    is klaar! De was is klaar!
  51. 99.
  52. 100.
  53. 102.
  54. 103.

    De was is klaar! De was is klaar! De was

    is klaar! De was is klaar!
  55. 104.
  56. 105.

    commandArray = {} if (uservariables['WasmachineBezig'] == 2) then s =

    uservariables_lastupdate['WasmachineBezig'] lastUpdate = os.time{ year=string.sub(s, 1, 4), month=string.sub(s, 6, 7), day=string.sub(s, 9, 10), hour=string.sub(s, 12, 13), min=string.sub(s, 15, 16), sec=string.sub(s, 18, 19) } difference = os.difftime (os.time(), lastUpdate) if (difference > 300) then commandArray['Variable:WasmachineBezig'] = '0' commandArray['OpenURL'] = 'pixel.local/api?command=notify&icon=shirt' end end return commandArray
  57. 107.
  58. 108.
  59. 109.