How to use the bonescript.analogWrite function in bonescript

To help you get started, we’ve selected a few bonescript examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jadonk / bone101 / examples / extras / mfba2014 / dcmotor.js View on Github external
function updateDuty() {
    b.analogWrite(MOTOR, speed, 60, scheduleNextUpdate);
    //console.log("Duty Cycle: " + 
    //    parseFloat(duty_cycle*100).toFixed(1) + " % " +
    //    "Position: " + position.toFixed(2));
}
github simonmonk / prog_bbb / Prog BBB / 07_02_brightness.js View on Github external
function brighter() {
    duty = duty + step;
    if (duty > 1.0) {
        duty = 1.0;
    }
    b.analogWrite(led, duty);
}
github simonmonk / prog_bbb / Prog BBB / 07_02_brightness.js View on Github external
function dimmer() {
    duty = duty - step;
    if (duty < 0.0) {
        duty = 0.0;
    }
    b.analogWrite(led, duty);
}
github simonmonk / prog_bbb / Prog BBB / 07_07_servo.js View on Github external
function setAngle(reading) {
    var angle = reading.value * 180.0;
    var dutyCycle = (angle / 1565.0) + minDuty;
    b.analogWrite(servoPin, dutyCycle, 50); 
}

bonescript

Physical computing library for embedded Linux

MIT
Latest version published 5 years ago

Package Health Score

42 / 100
Full package analysis