I get an error when I upload the JS file to the CH341SER using VSC with Terminal.
Here is the error:
internal/modules/cjs/loader.js:965
throw err;
^
Error: Cannot find module 'C:\Users\HP\run.js'
←[90m at Function.Module._resolveFilename (internal/modules/cjs/loader.js:962:15)←[39m
←[90m at Function.Module._load (internal/modules/cjs/loader.js:838:27)←[39m
←[90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)←[39m
←[90m at internal/main/run_main_module.js:17:47←[39m {
code: ←[32m'MODULE_NOT_FOUND'←[39m,
requireStack: []
}
Here is the code:
const five = require('johnny-five');
const board = new five.Board();
board.on('ready', () => {
const led = new five.Led(2);
led.blink(500);
});
The Arduino IDE works fine.
Here is the code:
#define OUR_LED 2
void setup() {
pinMode(OUR_LED, OUTPUT);
}
void loop() {
digitalWrite(OUR_LED, HIGH);
delay(1000);
digitalWrite(OUR_LED, LOW);
delay(1000);
}
Setup:
node-v13.14.0-x64 +
johnny-five package
Windows 7
This is the first time I've tried anything outside of the Arduino IDE. So, I don't know if the problem is the code, the Chinese microcontroller or the setup.
How can I fix this? Any help is much appreciated!