Classes

Posted on
  • 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

  • Waveform isn't in v 1.48 - see http://www.espruino.com/ChangeLog - it wasn't added until 1.53, and in versions since then, there have been considerable improvements made to it.

  • 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.

  • Yeah, that uses the RBT with only 128k of flash. Basically anything under 256k flash will have features cut to make room. I recommend the Espruino board, personally...

  • 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.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Classes

Posted by Avatar for Harry_T @Harry_T

Actions