Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
board.on('ready', function() {
var servo = new five.Servo({
pin: 'd0',
type: 'continuous',
deadband: [ 95, 96 ]
});
servo.stop();
io.sockets.on('connection', function (socket) {
console.log('sockets on connection');
socket.emit('setSchedule', currentTimeValue);
socket.on('click', function () {
console.log('socket is on');
// have servo turn counter clockwise incase any food is stuck before turning clockwise to dispense
board.on("ready", function() {
console.log("CONNECTED");
// Create a new `servo` hardware instance.
var servo = new five.Servo("D0");
temporal.queue([
{
delay: 0,
task: function(){
// min()
//
// set the servo to the minimum degrees
// defaults to 0
//
servo.min();
}
},{
delay: 1000,
task: function(){
// max()
function stopServo(params){
// parse params, params[0] should be "set_digital"
var pinNumber = params[1];
var servo = servos[pinNumber];
if (servo == null) {
log("creating new servo " + pinNumber);
try{
servo = new five.Servo(pinNumber);
servos[pinNumber] = servo;
} catch (err) {
dir(err);
log(err.stack.split("\n"));
}
}
log("servoNumber %d stop", pinNumber);
servo.stop();
pinWrites[pinNumber].mode = MODE_SERVO;
pinReads[pinNumber] = servo.value;
board.on("ready", function() {
servo = five.Servo({
pin: 9,
startAt: 90,
range: [0, 180],
interval: 10
});
servo.sweep([45,135]);
servo2 = five.Servo({
pin: 10,
startAt: 90,
range: [0, 180],
interval: 10
});
servo2.sweep([135,45]);
// servo.to(50);
// left();
});
board.on("ready", function() {
button = new five.Button(8);
var led = new five.Led(7);
var servo = new five.Servo(10);
board.repl.inject({
button: button,
led: led,
servo: servo
});
button.on("down", function() {
console.log("down");
led.on();
servo.min();
});
button.on("up", function() {
console.log("up");
board.on('ready', function() {
document.getElementById('board-status').src = 'icons/ready.png'
input.className = 'input'
input.readOnly = false
var servo = new five.Servo({pin: 10, startAt: 90, range: [45, 135]});
horn(position-90, '#505050')
input.addEventListener('change', function () {
var str = input.value
if (!isNaN(Number(str))) {
position = Number(str)
}
else if (str.charCodeAt(str.length-1) === 176){
if (!isNaN(Number(str.substring(0,str.length-1)))) {
console.log('number + degree')
position = Number(str.substring(0,str.length-1))
}
}
if (position < 45) position = 45
if (position > 135) position = 135
position = Math.round(position)
break;
case "analogRead":
board.pinMode(payload.pin, five.Pin.ANALOG);
board.analogRead(payload.pin, function(value) {
if(_.has(component, payload.name)){
read[payload.name] = value;
}
});
break;
case "analogWrite":
board.pinMode(payload.pin, five.Pin.PWM);
names.push(payload.name);
break;
case "servo":
servo[payload.name] = new five.Servo({
pin: payload.pin,
});
names.push(payload.name);
break;
case "PCA9685-Servo":
servo[payload.name] = new five.Servo({
address: 0x40,
controller: "PCA9685",
pin: payload.pin,
});
names.push(payload.name);
case "oled-i2c":
debug("oledddoo");
var opts = {
width: 128,
height: 64,
board.on('ready', function () {
var led = new five.Led(13);
led.off();
lServo = new five.Servo({
pin: 11,
type: 'continuous'
});
rServo = new five.Servo({
pin: 10,
type: 'continuous'
});
marker = new five.Servo({
pin: 9
});
moves.stop();
marker.center();
var piezo = new five.Sensor({
pin: "A0",
threshold: 10
});
piezo.on("change", function() {
box.knock(this.value);
});
var button = new five.Button(2);
button.on("press", function() {
box.lock();
});
var yellow = new five.Led(3);
var green = new five.Led(4);
var red = new five.Led(5);
var servo = new five.Servo(9);
var box = new Box(servo, red, green, yellow);
});
range: [35, 145] //Too high of a minimum input will cause issues with the forward kinematics
});
servo2 = five.Servo({
address: 0x40,
controller: "PCA9685",
pin: 1,
range: [35, 145]
});
servo3 = five.Servo({
address: 0x40,
controller: "PCA9685",
pin: 2,
range: [35, 145]
}); */
servo1 = five.Servo({
pin: 9,
range: [0, 100]
});
servo2 = five.Servo({
pin: 10,
range: [0, 100]
});
servo3 = five.Servo({
pin: 11,
range: [0, 100]
});
board.repl.inject({
servo1: servo1,