You are reading a single comment by @DrAzzy and its replies. Click here to read the full conversation.
  • Installed and tested with the code I've been working with lately (it's a control panel - takes input from a keypad, displays data on a PCD8544, and allows the user to set brightness of 5 channels of LEDs (output via analogWrite) for my desk lamp project. And it reads from a DHT11 (would be a DHT22, except I fried mine) and displays the temperature and "humidity".

    v60 seems to work without issue. I'm going to leave it running while I'm out with my code running on it (it's updating a display and reading a dht - though not logging anything - I've yet to move the PCD8544 off of SPI and onto a soft-SPI, though i'll do that later and see if that works reliably).

    The new PCD8544 driver doesn't work (rows after the first block of 8 are shifted left and slowly walk across the screen as flip() is called) , but that's unrelated to this - I'll take a look at it tonight. Edit: Looked, fixed, pull requested.

    After letting it run a few hours - no dice - same thing happens to me - after running for a while, it suddenly runs out of memory and dies. This happened at some point between 35 mins and 4.5 hrs. getTime() is returning accurate results (ie, that bug hasn't returned). The same code was running flawlessly overnight yesterday.

    ERROR: Out of Memory!
    WARNING: Out of memory while appending to array
    at line 1 col 92
    {pinMode(b.pin,"input_pullup");b.watch=s­etWatch(function(a){b.onwatch(a)},b.pin,­{repeat:!0})}
                                                                                                ^
    in function called from system
    Execution Interrupted during event processing.
    ERROR: Unknown Watch
    ERROR: Out of Memory!
    WARNING: Unable to create string as not enough memory
    ERROR: Got INT expected ')' at line 1 col 230
    {this.onreadf=a;this.i=0;this.out=1;pinM­ode(this.pin);var b=this;setTimeout(function(){digitalWrit­e(b.pin,0)},2);setTimeout(function(){pin­Mode(b.pin,"input_pullup");b.watch=setWa­tch(function(a){b.onwatch(a)},b.pin,{rep­eat:!0})},5);setTimeout(function(){b.onr­ead(b.endRead())},50)}
                                                                                                                                                                                                                                          ^
    at line 1 col 229
    {this.onreadf=a;this.i=0;this.out=1;pinM­ode(this.pin);var b=this;setTimeout(function(){digitalWrit­e(b.pin,0)},2);setTimeout(function(){pin­Mode(b.pin,"input_pullup");b.watch=setWa­tch(function(a){b.onwatch(a)},b.pin,{rep­eat:!0})},5);setTimeout(function(){b.onr­ead(b.endRead())},50)}
                                                                                                                                                                                                                                         ^
    in function "read" called from line 1 col 76
    in function "onread" called from line 1 col 22
    in function called from system
    Execution Interrupted during event processing.
    ERROR: Out of Memory!
    ERROR: Out of Memory!
    WARNING: Unable to create string as not enough memory
    ERROR: Out of Memory!
    WARNING: Unable to create string as not enough memory
    ERROR: Out of Memory!
    WARNING: Out of memory while appending to array
    ERROR: Out of Memory!
    at line 1 col 279
    {this.onreadf=a;this.i=0;this.out=1;pinM­ode(this.pin);var b=this;setTimeout(function(){digitalWrit­e(b.pin,0)},2);setTimeout(function(){pin­Mode(b.pin,"input_pullup");b.watch=setWa­tch(function(a){b.onwatch(a)},b.pin,{rep­eat:!0})},5);setTimeout(function(){b.onr­ead(b.endRead())},50)}
                                                                                                                                                                                                                                                                                           ^
    in function "read" called from line 1 col 38
    ERROR: Error processing interval - removing it.
    Execution Interrupted during event processing.
    ERROR: Out of Memory!
    at line 1 col 21
    {for(var a=0;6>a;a++)digitalWrite(d,0),b.send(64|­a,c),b.send(128,c),digitalWrite(d,1),b.s­end(new Uint8Array(this.buffer,84*a,84),c)}
                         ^
    in function "flip" called from line 2 col 219
    in function "uplcd" called from line 1 col 8
    in function called from system
    ERROR: Error processing interval - removing it.
    Execution Interrupted during event processing.
    >
    

    Code that made it:

    var rh=-1;
    var t=-1;
    var statusview=1;
    var menustate=0;
    var menuopt=0;
    var inval="";
    var colors=["BLUE","COOL","WARM","YELL","PIN­K"];
    var ledstate=[0.4,1,0.8,0,0.2];
    var menu=[0,4];
    var ledpins=[B0,C9,C8,C7,C6];
    
    var kp=require("KeyPad").connect([C12,C15,C0­,C1],[C2,C3,A0,A1], function(e) {onKey(e);});
    require("Font8x12").add(Graphics);
    
    function onKey(e){
    	var k="123A456B789C*0#D"[e];
    	if (e==12){
    		if (menustate==2){
    			menustate=0;
    		} else {
    			menustate++;
    		}
    		menuopt=0;
    		inval="";
    		uplcd();
    	} else if (e==14 && menustate) {
    		if (menustate==1) {
    			var v=E.clip(parseInt(inval),0,100);
    			v=v/100;
    			ledstate[menuopt]=v;
    			inval="";
    			uplcd();
    			setTimeout("upled();",500);
    		}
    	} else if (e==3 && menustate) {
    		if (menuopt>=menu[menustate]) {
    			menuopt=0;
    		} else {
    			menuopt++;
    		}
    		inval="";
    		uplcd();
    	} else if ((e&0x03)==3) {
    		console.log(k);
    	} else if (menustate==1) {
    		if (inval.length < 3) {
    			inval=inval+k;
    		} else {
    			inval="";
    		}
    		uplcd();
    	}
    
    	g.backlighton();
    }
    
    digitalWrite(A13,0);
    var g=require("PCD8544").connect(SPI2,C4,C5,­A3, function() {
            g.clear();
            g.setFont8x12();
            g.drawString("LCD OK",0,0);
            g.flip();
            g.bktim=0;
    });
    
    g.backlighton = function() {
    	digitalWrite(A2,1);
    	if (this.bktim) {
    		clearTimeout(this.bktim);
    		this.bktim=0;
    	}
    	this.bktim=setTimeout("digitalWrite(A2,0­);g.bktim=0;",5000);
    };
    
    var e=require("DHT11").connect(B0);
    
    setInterval("e.read(function(a){rh=a.rh;­t=a.temp;});",30000);
    
    setTimeout("setInterval(function(){uplcd­();},30000)",15000);
    
    function uplcd() {
    	g.clear();
    	g.setFont8x12();
    	g.drawString(t.toFixed(1)+" C "+rh.toFixed(1)+"%",0,0);
    	if (statusview==1) {
    		g.drawRect(3,14,8,39);
    		g.drawRect(12,14,19,39);
    		g.drawRect(23,14,30,39);
    		g.drawRect(34,14,39,39);
    		g.drawRect(43,14,48,39);
    		g.fillRect(3,(39-ledstate[0]*25),8,39);
    		g.fillRect(12,(39-ledstate[1]*25),19,39)­;
    		g.fillRect(23,(39-ledstate[2]*25),30,39)­;
    		g.fillRect(34,(39-ledstate[3]*25),39,39)­;
    		g.fillRect(43,(39-ledstate[4]*25),48,39)­;
    		g.setFontBitmap();
    		g.drawString("B",4,41);
    		g.drawString("C",14,41);
    		g.drawString("W",25,41);
    		g.drawString("Y",35,41);
    		g.drawString("P",44,41);
    	}
    	if (menustate==1) {
    		g.setFont8x12();
    		g.drawString(colors[menuopt],52,13);
    		g.drawString((100*ledstate[menuopt]).toF­ixed(),60,24);
    		if (inval) {
    			g.drawString(inval,60,35);
    		}
    	}
    	g.flip();
    }
    
    function upled() {
    	for (var i=0;i<5;i++) {
    		analogWrite(ledpins[i],ledstate[i]);
    	}
    }
    
    

    Also, sometimes the IDE just hangs while sending code to it - showing echo(0), and doing nothing. I'm not quite sure what it's doing, but it does it first thing when it runs, because if I send over code where echo(1); is the first line, it still hangs showing echo(0); until I ctrl+c, which breaks it out of whatever it's doing and it then successfully runs all the code I sent it.

About

Avatar for DrAzzy @DrAzzy started