Due to high demand expect some shipping delays at this time, orders may not ship for 3-4 business days.
0

ERROR
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

ERROR

by Jmiramo22 on Mon Dec 06, 2021 9:57 pm

So I'm programming on the Beaglebone black and I am trying to run a simple traffic light and am getting an error with my code here is my code:

Code: Select all | TOGGLE FULL SIZE
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;
            }
        }
             


I am getting this error message: "warning: single argument callbacks will be deprecated.please use node-style error-first callbacks: callback(err,response)

Jmiramo22
 
Posts: 2
Joined: Wed Dec 01, 2021 3:03 pm

Re: ERROR

by dastels on Mon Dec 06, 2021 11:24 pm

1. It's a warning, not an error
2. It shouldn't be an issue for now (until it's actually deprecated), but do what it says and update your callback.

Dave

dastels
 
Posts: 8476
Joined: Tue Oct 20, 2015 3:22 pm

Please be positive and constructive with your questions and comments.