Skip to content

Instantly share code, notes, and snippets.

@bathtimefish
Last active August 29, 2015 04:09
Show Gist options
  • Save bathtimefish/8d2c21f9df38d44333c5 to your computer and use it in GitHub Desktop.
Save bathtimefish/8d2c21f9df38d44333c5 to your computer and use it in GitHub Desktop.
EspruinoでATモジュールを使うサンプル ESP8266 version 0.25 とお話をする
/*
* AT モジュールは通常IDEのファームロードやCLIからrequireできない。
* しかしIDEからrequire("ESP8266WiFi_0v25")のロードに成功した後はCLIから使えるようになる。
* このあたりの仕様はナゾだけど、ATコマンドのデバッグには便利なので使ったほうがいい
*
* See: AT.js - https://github.com/espruino/EspruinoDocs/blob/master/modules/AT.js
*
*/
Serial1.setup(115200, { rx: B7, tx : B6 });
require("ESP8266WiFi_0v25").connect(Serial1, function(err) {
var at = require("AT").connect(Serial1);
at.cmd("AT+GMR\r\n", 1000, function(d) {
console.log(d); // AT version:0.25.0.0(Jun 5 2015 16:27:16)
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment