Closed yoshihikko-kodaira closed 5 months ago
The infrared sensor is working properly, but the program is not returning the correct value.
import { SerialPort, attachHallEffectSensor, attachLed, board } from "edison"; board.connectManual("/dev/ttyUSB0"); board.on("ready", (port: SerialPort) => { console.log("Board is ready!"); const led1 = attachLed(port, 13); const infraredObstacleAvoidanceSensor = attachHallEffectSensor(port, 3); infraredObstacleAvoidanceSensor.read("on", () => { led1.on(); console.log(1); }); infraredObstacleAvoidanceSensor.read("off", () => { led1.off(); console.log(0); }); });
In the above code, when the sensor is on, the value 0 may be output.
Thank you so much your report of bug!! I reviced this bug and I 'll push PR here!
The infrared sensor is working properly, but the program is not returning the correct value.
In the above code, when the sensor is on, the value 0 may be output.