O:302

From Sudo Room
Revision as of 12:29, 22 May 2016 by Captain morgan (talk | contribs) (Created page with "== Sudo Clock == === Firmware === Firmware uses the standard [http://bbs.espressif.com/viewtopic.php?f=46&t=2198 ESP8266 SDK]. Any version from 1.4.0 should work, but newer (...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Sudo Clock

Firmware

Firmware uses the standard ESP8266 SDK. Any version from 1.4.0 should work, but newer (past 1.5.0) has many bug fixes and optimizations.

The current version is available in the talk branch on GitHub. Once your SDK is setup running make should be enough to getting it running. Check the make file for various config options, most likely you'll want to set WIFI_SSID and WIFI_PWD if you're not intending to connect it to openpeoples.net. Beyond that ESPPORT is the only other thing you change, if the device is not appearing as /dev/ttyUSB0

Talk

Talk Script

 var dgram = require("dgram");
 var msg = process.argv.pop();

 var pos = 0;

 var socket = dgram.createSocket("udp4");

 function pushMessage(e) {
   var b = new Buffer(9);
   b.write(msg.slice(pos, pos + 8));
   b.write("\0", 8);

   socket.send(b, 0, b.length, 1234, "100.64.64.206", function(e) {
     pos++;

     if(msg.length - pos >= 8)
       setTimeout(pushMessage, 1000);
     else
       socket.close();
   });
 }

 pushMessage();

This can the be used like node talk.js "HELLO, SUDOROOM"```