Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
nano.on('ready', function start() {
// Define variables
heater = new five.Pin(6);
airlift = new five.Pin(7);
aerator = new five.Pin(8);
water_pump = new five.Pin(9);
level = new five.Sensor('A3');
level_ref = new five.Sensor('A2');
// This requires OneWire support using the ConfigurableFirmata
let thermometer = new five.Thermometer({
controller: 'DS18B20',
pin: 4
});
thermometer.on('change', function() {
try {
water_temp = this.celsius;
} catch(err) {
console.log(err);
}
});
board.on('ready', function() {
// Create a new `nunchuk` hardware instance.
const nunchuk = new five.Wii.Nunchuk({
freq: 50
});
new five.Pin("A2").low();
new five.Pin("A3").high();
nunchuk.joystick.on('change', function(event) {
console.log(
'joystick ' + event.axis,
event.target[event.axis],
event.axis, event.direction
);
});
nunchuk.accelerometer.on('change', function(event) {
console.log(
'accelerometer ' + event.axis,
event.target[event.axis],
event.axis, event.direction
);
});
function setAnalog(params){
// parse params, params[0] should be "set_analog"
var pinNumber = params[1],
pinVal = params[2];
if (pinWrites[pinNumber] == null) {
log("creating new pin " + pinNumber);
try{
var pin = new five.Pin(pinNumber);
pinWrites[pinNumber] = pin;
_registerPinRead(pin);
} catch (err) {
dir(err);
log(err.stack.split("\n"));
}
}
dir(pinWrites[pinNumber]);
log("set analog pinNumber %s, pinVal %d", pinNumber, pinVal);
pinWrites[pinNumber].write(pinVal);
pinReads[pinNumber] = pinVal;
board.on('ready', function start() {
var pH_reading,
pH_readings = [],
eC_reading,
eC_readings = [];
var acidpump = new five.Pin('P1-11'),
basepump = new five.Pin('P1-12'),
nutrientpump = new five.Pin('P1-13');
// Hack: Relays are inversed... make sure pumps are off.
// Better hardware could take care of this... I'm not an electrical engineer.
acidpump.high();
basepump.high();
nutrientpump.high();
// This must be called prior to any I2C reads or writes.
// See Johnny-Five docs: http://johnny-five.io
this.i2cConfig();
// Create a new theDr instance and connect to https://theDr.commongarden.org
var theDr = new GrowInstance({
uuid: '04b19f61-adcf-4763-b2e1-a8bf93447970',
token: 'hQ5Svts8DJkqrcBT4W6aCxFxy9hWy5dT',
webcomponent: 'dr-dose',
board.on('ready', function start() {
// Declare variables and pins
var pH_reading;
var pH_readings = [];
var circpump = new five.Pin(10);
var acidpump = new five.Pin(11);
var basepump = new five.Pin(12);
// This must be called prior to any I2C reads or writes.
// See Johnny-Five docs: http://johnny-five.io
this.i2cConfig();
// Create a new grow instance. Connects by default to localhost:3000
// Create a new grow instance.
var grow = new GrowInstance({
name: 'Dr. Dose', // The display name for the thing.
desription: 'Dr. Dose keeps your pH balanced.',
// The username of the account you want this device to be added to.
username: 'jake2@gmail.com',
// Properties can be updated by the API
properties: {
board.on('ready', function start() {
// Define variables
circ_pump = new five.Pin('GPIO26');
doser = new five.Pin('GPIO20');
heater = new five.Pin('GPIO21');
let bioreactor = new Grow({
uuid: 'meow',
token: 'meow',
component: 'BioReactor',
properties: {
light_state: null,
heater: 'off',//1
circ_pump: 'off',//2
doser: 'off',//3
water_level: null,
duration: 2000,
interval: 30000,
threshold: 50,
growfile: {
name: 'Yeast',
board.on('ready', function start() {
var pH_reading,
pH_readings = [],
eC_reading,
eC_readings = [];
var acidpump = new five.Pin('P1-11'),
basepump = new five.Pin('P1-12'),
nutrientpump = new five.Pin('P1-13');
// Hack: Relays are inversed... make sure pumps are off.
// Better hardware could take care of this... I'm not an electrical engineer.
acidpump.high();
basepump.high();
nutrientpump.high();
// This must be called prior to any I2C reads or writes.
// See Johnny-Five docs: http://johnny-five.io
this.i2cConfig();
// Create a new theDr instance and connect to https://theDr.commongarden.org
var theDr = new GrowInstance({
uuid: '04b19f61-adcf-4763-b2e1-a8bf93447970',
token: 'hQ5Svts8DJkqrcBT4W6aCxFxy9hWy5dT',
nano.on('ready', function start() {
// Define variables
var one = new five.Pin(6),
two = new five.Pin(7),
three = new five.Pin(8),
four = new five.Pin(9);
one.high();
two.high();
three.high();
four.high();
// This requires OneWire support using the ConfigurableFirmata
var thermometer1 = new five.Thermometer({
controller: "DS18B20",
pin: 4
});
var thermometer2 = new five.Thermometer({
controller: "DS18B20",
pin: 5
nano.on('ready', function start() {
// Define variables
heater = new five.Pin(6);
airlift = new five.Pin(7);
aerator = new five.Pin(8);
water_pump = new five.Pin(9);
level = new five.Sensor('A3');
level_ref = new five.Sensor('A2');
// This requires OneWire support using the ConfigurableFirmata
let thermometer = new five.Thermometer({
controller: 'DS18B20',
pin: 4
});
thermometer.on('change', function() {
try {
water_temp = this.celsius;
} catch(err) {
board.on("ready", function() {
var gate = new five.Pin(9);
var button = new five.Button(2);
button.on("press", function() {
gate.write(1);
});
button.on("release", function() {
gate.write(0);
});
});