This Code is for a simple Traffic Light, now when running it on the Beaglebone black I receive the warning:”warning: single argument callbacks will be deprecated.please use node-style error-first callbacks: callback(err,response)”. I am unsure of how do do what its asking in my code any help would be appreciated.
var b = require('bonescript');
var red = "p8_13";
var yellow = "p8_15";
var green = "P8_17";
var inputPin = "P8_10";
var switchstatus =0;
b.pinMode(red,b.OUTPUT);
b.pinMode(yellow,b.OUTPUT);
b.pinMode(green,b.OUTPUT);
b.pinMode(inputPin,b.OUTPUT);
var on = b.HIGH;
var off = b.LOW;
setInterval(check,200);
function check(){
b.digitalRead(inputPin, checkButton);
}
function checkButton(x){
if (x.value == 1){
switchstatus++;
switch (switchstatus){
case 1: setTimeout(function
(){b.digitalWrite(red,on);
b.digitalWrite(yellow,off);
b.digitslWrite(green,off);},500);
break;
case 2: setTimeout (function
(){b.digitalWrite(yellow,on);},500);
break;
case 3: setTimeout (function
(){b.digitalWrite(red,off);
b.digitalWrite(green,on);},500);
break;
case 4: setTimeout (function
(){b.digitalWrite(yellow,on)
b.digitalWrite(green, on);},500);
break;
default: swtchstatus = 0;
break;
}
}
else if (switchstatus >=5){
switchstatus = 0;
callback(err,response);
}
}