Hi friends.
I'm trying to get confidence with Espruino-wifi.
Here is a very simple program that just HPPT.get to a we server, on every 20 secs.
I've measured the current adsorbed and it is never below 20mA.
Of course it peaks to about 90mA when transmitting, but this is not the problem.
When measuring the board is not connected to USB.
Power (5V) is supplied on pins GND and VBA.
I was expecting less that 1 mA when deepSleeping, but, as far as I understand, I'm not able to convince the board to sleep deep enought :-).
So thanks for your help.
Marco
Here is my code.
function manage() {
//USB.setConsole();
var WIFI_NAME = "tzaziki";
var WIFI_OPTIONS = {
password: ""
};
var wifi = require("EspruinoWiFi");
var HTTP = require ("http");
setDeepSleep(1);
wifiConnected = false;
// Need to connect before setIntervan (..) because it will produce a timeout
wifi.connect(WIFI_NAME, WIFI_OPTIONS, function(err) {
if (err) {
console.log("Connection error: " + err);
} else {
console.log("Connected!");
wifiConnected = true;
}
});
setInterval(function() {
console.log ("new cycle ...");
if (wifiConnected === false)
{
console.log ("reconecting to wifi...");
wifi.connect(WIFI_NAME, WIFI_OPTIONS, function(err) {
if (err) {
console.log("Connection error: " + err);
} else {
console.log("Connected!");
wifiConnected = true;
}
});
}
HTTP.get("http://192.168.1.121:1880/espruino?Temp=24", function(res) {
res.on('data', function(data) {
console.log(data);
});
res.on('close', function(data) {
console.log("HTTP got close.");
});
res.on('error', function(data) { // timeout not trapped
console.log("HTTP error.");
wifiConnected = false;
});
});
}, 20000);
console.log("deepSleep enabled.");
setDeepSleep(1);
}
function onInit() {
manage();
}
save();
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hi friends.
I'm trying to get confidence with Espruino-wifi.
Here is a very simple program that just HPPT.get to a we server, on every 20 secs.
I've measured the current adsorbed and it is never below 20mA.
Of course it peaks to about 90mA when transmitting, but this is not the problem.
When measuring the board is not connected to USB.
Power (5V) is supplied on pins GND and VBA.
I was expecting less that 1 mA when deepSleeping, but, as far as I understand, I'm not able to convince the board to sleep deep enought :-).
So thanks for your help.
Marco
Here is my code.