You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Looking at this now - seems everything is working but there's an issue with the ordering of module initialisation. Easiest solution for now is to just do:

    require("HC-SR04");
    var mymodule = require("mymodule")...;
    

    ... Or, I guess you're doing something like this in your module:

    var foo = require("HC-SR04");
    
    exports.abc = function() {
    };
    

    But if you did this, it'd all work:

    exports.abc = function() {
      var foo = require("HC-SR04");  
    };
    

    ... just to add, I don't think there's anything different with the projects code at all - all modules are handled the same right now. It's just that if modules use other modules, they're generally written not to use them in the global scope.

About

Avatar for Gordon @Gordon started