I am making a node.js raspberry pi app where I need to control a servo motor. When I press the up arrow, it sends a post request to '/fb' and on key up it sends a post request to '/fbTerm'. Here is the code for post requests.
const express = require('express')
, GPIO = require('pigpio').Gpio
, app = express()
, http = require('http').createServer(app);
var m1 = new GPIO(10, { mode: GPIO.OUTPUT });
app.post('/fb', (req, res) => {
m1.servoWrite(700);
});
app.post('/fbTerm', (req, res) => {
m1.servoWrite(1500);
});
After pressing and letting go of the up arrow a few times the continuous servo motor suddenly stops being controlled. I used a console.log
and after 3 console.log
s per each request the motor just doesn't respond to the m1.servoWrite
. Thanks for any help.