You are reading a single comment by @Nickax and its replies. Click here to read the full conversation.
  • In fairness - the example even says to paste on the right - I just jumped the gun in my excitement to get something working.

    Perhaps you can help with the next problem - I wired up the DS18b20

    and after stripping the whitespace - which broke the pasted code

    I upload and run this (from the right window!) :-

    var ow = new OneWire(D13);
    var sensor = require("DS18B20").connect(ow);
    setInterval(function() {sensor.getTemp(function (temp) {console.log("Temp is "+temp+"°C");});}, 1000);
    

    Which - might be working - but it certainly isn't outputting anything to either the left window or the Pixl's screen

    So I thought i'd add a console.log to the Setinterval callback - like this:-

    var ow = new OneWire(D13);
    var sensor = require("DS18B20").connect(ow);
    setInterval(function() {console.log("hi");sensor.getTemp(functi­on (temp) {console.log("Temp is "+temp+"°C");});}, 1000);
    

    When I upload and run this .. there is a very short delay (probably the 1000ms) .. then it throws (on the left)

     1v99 (c) 2018 G.Williams
    >Uncaught SyntaxError: Got EOF expected '}'
     at line 1 col 101
    ...console.loC");});}, 1000);
                                 ^
    =undefined
    > 
    

    It seems incredibly fragile - and like anything I write breaks it - I've seen other posts where peoples program are getting corrupted - Am I suffering with that?

About

Avatar for Nickax @Nickax started