Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function updateDuty() {
b.analogWrite(MOTOR, speed, 60, scheduleNextUpdate);
//console.log("Duty Cycle: " +
// parseFloat(duty_cycle*100).toFixed(1) + " % " +
// "Position: " + position.toFixed(2));
}
function brighter() {
duty = duty + step;
if (duty > 1.0) {
duty = 1.0;
}
b.analogWrite(led, duty);
}
function dimmer() {
duty = duty - step;
if (duty < 0.0) {
duty = 0.0;
}
b.analogWrite(led, duty);
}
function setAngle(reading) {
var angle = reading.value * 180.0;
var dutyCycle = (angle / 1565.0) + minDuty;
b.analogWrite(servoPin, dutyCycle, 50);
}