// cc3000_connect
pinMode(A10,'input_pullup');
setBusyIndicator(LED3); // GUL
setWatch(function() {
console.log("----------Interrupt----------");
}, B8, { repeat: true, edge: 'falling', debounce: 50 });
id0 = setInterval(function(){
digitalPulse(LED2,1,70); // BLÅ
},500);
var i = 0;
var alt = false;
var bool = false;
var http = require("http");
var wlan = require("CC3000").connect();
wlan.connect( "Propeller", "thaeBoLiit", function (s) {
if (s=="dhcp") {
console.log("MY IP is " + wlan.getIP().ip);
bool = true;
// test();
}
});
console.log("Frida is my watchdog");
//console.log(process.memory());
function test() {
if(bool){
bool = false;
alt = !alt;
if(alt){
httpa = "http://www.pur3.co.uk/hello.txt";
}else{
httpa = "http://www.pur3.co.uk/time.php";
}
http.get(httpa, function(res)
{
digitalWrite(LED1,1); // RØD
res.on('data', function(data) {
console.log(i + " > " + data);
});
res.on('close', function() {
data = " ";
digitalWrite(LED1,0); // RØD
bool = true;
i++;
id1 = setInterval(function(){
clearInterval(id1);
test();
},10); //1000 ms
});
});
}else{
console.log(i + " ----missed----");
}
// i++;
if(i == 1000){
// changeInterval(id0, 200);
// console.log(process.memory());
}
} // test end
/*
' why cant this work
setWatch(function() {
console.log("Button pressed");
}, BTN, { repeat: true, edge: 'rising', debounce: 50 });
*/
// you'll need to use edge: 'falling' if you connected the button to 0v 'rising'
/*
dont insert a line after i+
f.eks. i = i + 5;
then I got no ready sign
even a comment // do not insert something here!
*/
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.
This is my testscript for the moment.