alexander-daniel
Member since Mar 2014 • Last active Mar 2014Most recent activity
-
Cool! Got it working, albiet she's a bit shakey. The CC3000 does seem a bit finicky for sure! I can't make too many POSTs, too quickly, and sometimes it just needs to restart after 5-10 successful POSTs. Does the CC3000 hold a connection for as long as it can? Or do you have to run all of your logic inside of the .connect() callback?
-
Thanks Gordon! I tried the dev IDE and it works a bit better, but I still can't make a proper POST. The CC3000 times out and restarts everytime, or I get a socket-1 error.
Here is my code:
var wlan = require("CC3000"); var http = require("http"); var data = JSON.stringify([{ x : 0, y : 1, type : "scatter", mode : "markers" }]); var layout = JSON.stringify({ fileopt : "extend", filename : "Espruino" }); var payload = { un : "demos", key : "tj6mr52zgp", origin : "plot", platform : "rest", args : data, kwargs : layout, version : "0.0.1" }; function request() { var urlpayload = "un="+payload.un+"&key="+payload.key+"&origin="+payload.origin+"&platform="+payload.platform+"&args="+payload.args+"&kwargs="+payload.kwargs+"&version="+payload.version; var options = { host: 'plot.ly', method: 'POST', path: '/clientresp', headers: { 'Content-Type': 'application/x-www-form-urlencoded', 'Content-Length': urlpayload.length } }; var req = http.request(options, function(res) { console.log('STATUS: ' + res.statusCode); console.log('HEADERS: ' + JSON.stringify(res.headers)); res.on('data', function (chunk) { console.log('BODY: ' + chunk); }); }); req.on('error', function(e) { console.log('problem with request: ' + e.message); }); req.write(urlpayload); req.end(); } wlan.connect( "evilfriends", "password", function (s) { if (s=="dhcp") { console.log('wifi connected!'); request(); } });
It seems to be OK until it hits
req.end()
-
-
-
Hey guys, Super stoked on the Espruino, looks like a great platform. That being said, just having some small issues getting started.
I've installed the Chrome App on OS X, and have a regular Espruino board.
Now, I've hooked up a DHT11 to a pin (I've tried B2, B3, C0, C1, C2).
However, using the IDE, I cannot transfer over my sketches. I'm trying simply to use the example provided.
var dht = require("DHT11").connect(whatever pin im trying); dht.read(function (a) { console.log("Temp is "+a.temp.toString()+" and RH is "+a.rh.toString()); });
and nothing happens when i try to send this to the espruino. It just hangs on
echo(0);
It seems to be an issue with importing modules, as the same happens for a BMP085. Is there something wrong?
Another question:
Is it possible to stream using the espruino?
e.g
Does the espruino support TCP?