April 2018
Intermediate to advanced
248 pages
5h 31m
English
This function will update the duty cycle of the enable pin of both the motors and vary the speed of rotation:
module.exports.motor_speed = function(pwm,callback){ console.log(pwm) enable_1.pwmWrite(pwm); enable_2.pwmWrite(pwm); console.log ("speed change") callback("speed change")}
An indicator function is required which will make indicator LEDs on the left front and right front of the car blink whenever car makes a turn:
indicatorLeft = function(){ leftIndicatorHandler = setInterval(function() { if(front_left_LED.digitalRead()==1){ front_left_LED.digitalWrite(0) } else{ front_left_LED.digitalWrite(1) } },250)}
Now we will create an MQTT client for the car which will receive the commands from the MQTT broker. Here we are ...
Read now
Unlock full access