jonah.id / Smart Plug
  1. 2019-03-21 — Smart Plug Intro
  2. 2019-03-22 — Smart Plug Prototype 0.1 ⬿
  3. 2019-03-22 — Smart Plug Prototype 0.2
  4. 2019-03-22 — Smart Plug Prototype 0.3
  5. 2019-03-22 — Smart Plug Prototype 0.4
  6. 2019-03-27 — Smart Plug Prototype 0.5
  7. 2019-03-29 — Smart Plug Prototype 0.6
  8. 2019-04-04 — Smart Plug Prototype 1.0
  9. 2019-06-05 — Smart Plug Prototype 2.0
  10. 2019-07-14 — Rust on Arduino
  11. 2019-07-28 — W5500 Driver for Rust Embedded-HAL on AVR
  12. 2019-07-31 — Working UDP Listener in Rust (finally)

Smart Plug Prototype 0.1

After busting out the old Beaglebone Black and writing a few lines of JavaScript, I have a super simple LED toggle sequence on a timer running.

All it does is run a timer that switches the LEDs on and off at a fixed rate. Obviously nowhere near useful, but this is a simple building block. Next up we need to be able to control it.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
var b = require('bonescript');
var net = require('net');
var LEDS = [
  'USR0',
  'USR1',
  'USR2',
  'USR3'
];
LEDS.forEach(function (LED) {
  b.pinMode(LED, b.OUTPUT);
});
var on_led_index = 0;
setInterval(function () {
  b.digitalWrite(LEDS[on_led_index], b.LOW);
  on_led_index = (on_led_index + 1) % 4;
  b.digitalWrite(LEDS[on_led_index], b.HIGH);
}, 1000);

Next: 2019-03-22 — Smart Plug Prototype 0.2

Creative Commons License