You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • On http://www.espruino.com/Grove you've got some code up the top (under 'Software') that you can use pretty much as-is. For instance for Pixl.js you just do:

    var grove = require("arduino-grove").connect(); // for Pixl.js
    new (require("GroveButton"))(grove.D2, function(e) {
      if (e.state) console.log("Pressed");
      else console.log("Released");
    });
    

    However from Button onwards on the page, the code is explaining what functionality is available for you to use in the Grove libraries :

    • The commented out code on http://www.espruino.com/Grove actually contains examples of how to use the libraries.
    • The uncommented code (eg GroveRelay.prototype.on = function () { ... }) actually just describes the functions that are available for you to use.

    As it happens I don't believe there is a library for the DHT11 on Grove, but Grove itself is nothing special - it's just a connector, so what you were doing with:

    var dht = require("DHT22").connect(D3);
    dht.read(function (a) {console.log(JSON.stringify(a));});
    

    Sounds spot on - just as others have said you'll need to use the DHT11 module if you have a DHT11 - and ensure that you're using the right pin for it (as Grove connectors have two pins - a connector labelled D3 will probably use pins D3 and D4).

    Do you have a link to the exact arduino grove shield you're using? It might be that you're having issues because the shield is expecting power on the '5v' rail: http://www.espruino.com/Pixl.js#shield-p­ower

About

Avatar for Gordon @Gordon started