Avatar for Harry_T

Harry_T

Member since Feb 2014 • Last active Sep 2015
  • 3 conversations
  • 14 comments

Most recent activity

  • in JavaScript
    Avatar for Harry_T

    Yes - I think I will get one of the Espruino boards for the real experimenting. Just trying to find a use for these other ones I have first!
    Thanks for your help.

  • started
    • 5 comments
    • 2,450 views
  • in JavaScript
    Avatar for Harry_T

    That would explain it - thanks! I also have a 2.8" LCD version of the same board which runs v1.67 fine but seems to give the same error, just trying to run the first line.

    I presume that "Waveform" isn't in the 2.8" version as it's a small board.

  • in JavaScript
    Avatar for Harry_T

    Hello,
    I've come back to experimenting with this excellent tool and I've noticed there's a Waveform class.
    I've been trying to use it on a VET6 running v1.48 (I can't get newer versions to work - just get a white screen when I flash it).

    var w = new Waveform(256);
    for (var i=0;i<1024;i++) w.buffer[i] = 128+Math.sin(i*Math.PI/128)*127;
    analogWrite(A4, 0.5); 
    w.startOutput(A4, 4000);
    

    After the first line I get the error "ERROR: Constructor should be a function..."

    I am not sure how to use Classes, or if it is automatic. Is this Class not included in v1.48 - or the VET6?

    Many thanks,

    Harry

    • 11 comments
    • 4,492 views
  • in General
    Avatar for Harry_T

    Hi Gordon,
    Sorry, I'm not too familiar with the nightly build concept - I downloaded on the 30th Jan if that helps.

    An example of the delays I built in were as follows:

    function toggle3() {
    	LCD.clear();
        digitalPulse(A2,1,50);
    	digitalPulse(A2,0,50);
    
    	LCD.setColor(0, 0, 0);
        digitalPulse(A2,1,50);
    	digitalPulse(A2,0,50);
    
    	LCD.fillRect(1, 1, 320, 240);
        digitalPulse(A2,1,50);
    	digitalPulse(A2,0,50);
    
    	LCD.setColor(0, 1, 0);
        digitalPulse(A2,1,50);
    	digitalPulse(A2,0,50);
    
    	PotPos = analogRead(C0);
        digitalPulse(A2,1,50);
    	digitalPulse(A2,0,50);
    
        LCD.drawString(PotPos, 230, 210);
        digitalPulse(A2,1,50);
    	digitalPulse(A2,0,50);
    
    	setInterval(function() {
          LCD.clear();
          digitalPulse(A2,1,20);
          digitalPulse(A2,0,20);
          PotPos = analogRead(C0);
          digitalPulse(A2,1,20);
          digitalPulse(A2,0,20);
          LCD.drawString(PotPos, 200, 210);
    	}, 200);
    
    	digitalWrite(LED2,p=!p);
    }
    
    var l = false;
    var p = false;
    var PotPos = 0.1;
    
    setInterval("digitalWrite(LED1,l=!l);",8­00);
    
    setWatch(toggle3, E5, {repeat: true, edge:'falling'});
    

    Whether or not this program worked was dependent on the digitalPulse duration, and was often not repeatable. I found mathematical operations were less fussy than instructions involving the LCD.

    Introducing a SetInterval made things more complicated, and sometimes seemed to want a couple of digitalPulses at the end of the loop, and sometimes didn't. I'd have to evaluate one step at a time and see if it crashed.

  • in General
    Avatar for Harry_T

    I downloaded the latest version on the website a week ago - that was the version I was using.
    I found if I put delays (digital pulse) in between all my instructions, I could get the LCD to operate on save(); - however it was temperamental and results were not always repeatable. I programmed in a constantly flashing light so I could tell if it had hung or not, which would happen quite often. However, sometimes the light would flash but the LCD would just be white. Adding a delay or changing the delay time sometimes fixed this.

  • in General
    Avatar for Harry_T

    Serge's version at espruino-nightly.noda.se/2013-11-22/hyst­m32_24/ works perfectly and removes all the problems I'd been experiencing - I am now able to make the most of Espruino's power! A great tool. Thanks for making it Gordon.

  • in General
    Avatar for Harry_T

    Serge - many many thanks - that is about 300 times better!

    Best regards,

    Harry

  • in General
    Avatar for Harry_T

    Aha! I have it.

    1) Plug in the board with button 1 held down
    2) Re-connect in IDE
    3) Save(); in terminal
    4) Reset(); in terminal
    5) Copy and paste code in to terminal
    6) Save(); as normal

Actions