From 6d843f7097401fb6353b1061c768280a3e30104a Mon Sep 17 00:00:00 2001 From: Andrew Stewart Date: Thu, 6 Mar 2014 11:51:31 -0800 Subject: [PATCH] Remove Firmata examples They live in hybridgroup/cylon-firmata now. --- examples/analog_sensor/analog_sensor.coffee | 23 ------- examples/analog_sensor/analog_sensor.js | 28 -------- .../analog_sensor/analog_sensor.litcoffee | 47 -------------- examples/blink/blink.coffee | 12 ---- examples/blink/blink.js | 10 --- examples/blink/blink.litcoffee | 31 --------- examples/blinkm/blinkm.coffee | 30 --------- examples/blinkm/blinkm.js | 30 --------- examples/blinkm/blinkm.litcoffee | 64 ------------------- examples/button/button.coffee | 15 ----- examples/button/button.js | 16 ----- examples/button/button.litcoffee | 37 ----------- examples/led_brightness/led_brightness.coffee | 16 ----- examples/led_brightness/led_brightness.js | 19 ------ .../led_brightness/led_brightness.litcoffee | 43 ------------- examples/motor/motor.coffee | 17 ----- examples/motor/motor.js | 20 ------ examples/motor/motor.litcoffee | 46 ------------- examples/mpl115a2/mpl115a2.coffee | 16 ----- examples/mpl115a2/mpl115a2.js | 15 ----- examples/mpl115a2/mpl115a2.litcoffee | 31 --------- examples/servo/servo.coffee | 26 -------- examples/servo/servo.js | 20 ------ examples/servo/servo.litcoffee | 52 --------------- 24 files changed, 664 deletions(-) delete mode 100644 examples/analog_sensor/analog_sensor.coffee delete mode 100644 examples/analog_sensor/analog_sensor.js delete mode 100644 examples/analog_sensor/analog_sensor.litcoffee delete mode 100644 examples/blink/blink.coffee delete mode 100644 examples/blink/blink.js delete mode 100644 examples/blink/blink.litcoffee delete mode 100644 examples/blinkm/blinkm.coffee delete mode 100644 examples/blinkm/blinkm.js delete mode 100644 examples/blinkm/blinkm.litcoffee delete mode 100644 examples/button/button.coffee delete mode 100644 examples/button/button.js delete mode 100644 examples/button/button.litcoffee delete mode 100644 examples/led_brightness/led_brightness.coffee delete mode 100644 examples/led_brightness/led_brightness.js delete mode 100644 examples/led_brightness/led_brightness.litcoffee delete mode 100644 examples/motor/motor.coffee delete mode 100644 examples/motor/motor.js delete mode 100644 examples/motor/motor.litcoffee delete mode 100644 examples/mpl115a2/mpl115a2.coffee delete mode 100644 examples/mpl115a2/mpl115a2.js delete mode 100644 examples/mpl115a2/mpl115a2.litcoffee delete mode 100644 examples/servo/servo.coffee delete mode 100644 examples/servo/servo.js delete mode 100644 examples/servo/servo.litcoffee diff --git a/examples/analog_sensor/analog_sensor.coffee b/examples/analog_sensor/analog_sensor.coffee deleted file mode 100644 index 9f0128f..0000000 --- a/examples/analog_sensor/analog_sensor.coffee +++ /dev/null @@ -1,23 +0,0 @@ -Cylon = require '../..' - -Cylon.robot - connection: - name: 'arduino' - adaptor: 'firmata' - port: '/dev/ttyACM0' - - device: - name: 'sensor' - driver: 'analogSensor' - pin: 0 - upperLimit: 900 - lowerLimit: 100 - - work: (my) -> - my.sensor.on 'upperLimit', (val) -> - console.log "Upper limit reached ===> #{val}" - - my.sensor.on 'lowerLimit', (val) -> - console.log "Lower limit reached ===> #{val}" - -.start() diff --git a/examples/analog_sensor/analog_sensor.js b/examples/analog_sensor/analog_sensor.js deleted file mode 100644 index 4aa8f83..0000000 --- a/examples/analog_sensor/analog_sensor.js +++ /dev/null @@ -1,28 +0,0 @@ -var Cylon = require('../..'); - -Cylon.robot({ - connection: { - name: 'arduino', - adaptor: 'firmata', - port: '/dev/ttyACM0' - }, - - device: { - name: 'sensor', - driver: 'analogSensor', - pin: 0, - upperLimit: 900, - lowerLimit: 100 - }, - - work: function(my) { - my.sensor.on('upperLimit', function(val) { - console.log("Upper limit reached ===> " + val); - }); - - my.sensor.on('lowerLimit', function(val) { - console.log("Lower limit reached ===> " + val); - }); - } - -}).start(); diff --git a/examples/analog_sensor/analog_sensor.litcoffee b/examples/analog_sensor/analog_sensor.litcoffee deleted file mode 100644 index 5eab962..0000000 --- a/examples/analog_sensor/analog_sensor.litcoffee +++ /dev/null @@ -1,47 +0,0 @@ -# Analog Sensor - -A quick example of using an Arduino's analog sensor with Cylon. The program will -log to the console when the sensor has hit it's upper and lower limits. - -Before you run this program, make sure you have the `cylon-firmata` module -installed. - -First, let's load up Cylon: - - Cylon = require '../..' - -Now that we have Cylon imported, we can start defining our robot - - Cylon.robot - -Let's define the connection to our Arduino: - - connection: - name: "arduino" - adaptor: "firmata" - port: "/dev/ttyACM0" - -Now we can define the analog sensor we're going to use, along with it's upper -and lower limits: - - device: - name: 'sensor' - driver: 'analogSensor' - pin: 0 - upperLimit: 900 - lowerLimit: 100 - -Now that Cylon knows about the necessary hardware we're going to be using, we'll -tell it what work we want to do: - - work: (my) -> - my.sensor.on 'upperLimit', (val) -> - console.log "Upper limit reached: #{val}" - - my.sensor.on 'lowerLimit', (val) -> - console.log "Lower limit reached: #{val}" - -Now that our robot knows what work to do, and the work it will be doing that -hardware with, we can start it: - - .start() diff --git a/examples/blink/blink.coffee b/examples/blink/blink.coffee deleted file mode 100644 index 77e0fe1..0000000 --- a/examples/blink/blink.coffee +++ /dev/null @@ -1,12 +0,0 @@ -Cylon = require '../..' - -# Initialize the robot -Cylon.robot - connection: { name: 'arduino', adaptor: 'firmata', port: '/dev/ttyACM0' } - - device: { name: 'led', driver: 'led', pin: 13 } - - work: (my) -> - every 1.second(), -> my.led.toggle() - -.start() diff --git a/examples/blink/blink.js b/examples/blink/blink.js deleted file mode 100644 index 8cf9712..0000000 --- a/examples/blink/blink.js +++ /dev/null @@ -1,10 +0,0 @@ -var Cylon = require('../..'); - -Cylon.robot({ - connection: { name: 'arduino', adaptor: 'firmata', port: '/dev/ttyACM0' }, - device: {name: 'led', driver: 'led', pin: 13}, - - work: function(my) { - every((1).seconds(), function() {my.led.toggle()}); - } -}).start(); diff --git a/examples/blink/blink.litcoffee b/examples/blink/blink.litcoffee deleted file mode 100644 index 5324f0d..0000000 --- a/examples/blink/blink.litcoffee +++ /dev/null @@ -1,31 +0,0 @@ -# Blink - -For this very basic Cylon example, we're just going to hook up to an Arduino and -blink an LED on it with a one-second interval. - -To get started, let's load up Cylon: - - Cylon = require '../..' - -With Cylon loaded, we can now define our basic robot. - - Cylon.robot - -Our robot has one connection, to an Arduino using the `cylon-firmata` adaptor: - - connection: { name: "arduino", adaptor: "firmata", port: "/dev/ttyACM0" } - -Our robot also only has one device (or at least only one we're concerned about), -an LED on pin 13. - - device: { name: 'led', driver: 'led', pin: 13 } - -Next, we'll define the robot's work, which will be toggling the LED every -second: - - work: (my) -> - every 1.second(), -> my.led.toggle() - -And that's all the parts of our robot. All that's left is to start it. - - .start() diff --git a/examples/blinkm/blinkm.coffee b/examples/blinkm/blinkm.coffee deleted file mode 100644 index 9010a80..0000000 --- a/examples/blinkm/blinkm.coffee +++ /dev/null @@ -1,30 +0,0 @@ -Cylon = require '../..' - -Cylon.robot - connection: - name: 'arduino', adaptor: 'firmata', port: '/dev/ttyACM0' - - device: - name: 'blinkm', driver: 'blinkm' - - work: (my) -> - my.blinkm.on 'start', -> - my.blinkm.stopScript() - - my.blinkm.getFirmware((version) -> - Logger.info "Started BlinkM version #{version}" - ) - - my.blinkm.goToRGB(0,0,0) - - my.blinkm.getRGBColor((data) -> - console.log("Starting Color: #{ data }") - ) - - every 2.second(), () -> - my.blinkm.getRGBColor((data) -> - console.log("Current Color: #{ data }") - ) - my.blinkm.fadeToRandomRGB(128, 128, 128) - -.start() diff --git a/examples/blinkm/blinkm.js b/examples/blinkm/blinkm.js deleted file mode 100644 index 3891ab1..0000000 --- a/examples/blinkm/blinkm.js +++ /dev/null @@ -1,30 +0,0 @@ -var Cylon = require('../..'); - -Cylon.robot({ - connection: { name: 'arduino', adaptor: 'firmata', port: '/dev/ttyACM0' }, - - device: { name: 'blinkm', driver: 'blinkm' }, - - work: function(my) { - my.blinkm.on('start', function() { - - my.blinkm.stopScript(); - - my.blinkm.getFirmware(function(version) { - Logger.info("Started BlinkM version " + version); - }); - - my.blinkm.goToRGB(0,0,0); - my.blinkm.getRGBColor(function(data){ - console.log("Starting Color: ", data) - }); - - every((2).second(), function() { - my.blinkm.getRGBColor(function(data){ - console.log("Current Color: ", data); - }); - my.blinkm.fadeToRandomRGB(128, 128, 128); - }); - }); - } -}).start(); diff --git a/examples/blinkm/blinkm.litcoffee b/examples/blinkm/blinkm.litcoffee deleted file mode 100644 index 330665d..0000000 --- a/examples/blinkm/blinkm.litcoffee +++ /dev/null @@ -1,64 +0,0 @@ -# BlinkM - -For this example, we're going to use the `cylon-firmata` module to blink a light -using BlinkM. - -Before we start, make sure you've got the `cylon-firmata` module installed. - -First, let's import Cylon: - - Cylon = require '../..' - -With Cylon imported, we can start defining our robot. - - Cylon.robot - -Our robot will be using an Arduino, and communicating over the Firmata protocol - - connection: - name: 'arduino', adaptor: 'firmata', port: '/dev/ttyACM0' - -And we'll have one device, a BlinkM led. - - device: - name: 'blinkm', driver: 'blinkm' - -We'll now set up our robot's work. - - work: (my) -> - -When the BlinkM sends the 'start' event, we'll set up our events - - my.blinkm.on 'start', -> - -We stop the default BlinkM's light script - - my.blinkm.stopScript() - -We'll request the BlinkM's version, and print that to the console - - my.blinkm.getFirmware((version) -> - Logger.info "Started BlinkM version #{version}" - ) - -By default, we'll turn the LED off - - my.blinkm.goToRGB(0,0,0) - -We print the default starting color (in this case 0,0,0 since we turned the led off) - - my.blinkm.getRGBColor((data) -> - console.log("Starting Color: #{ data }") - ) - -Now, every 2 seconds, we'll change the LED color to a random value: - - every 2.second(), -> - my.blinkm.getRGBColor((data) -> - console.log("Current Color: #{ data }") - ) - my.blinkm.fadeToRandomRGB(128, 128, 128) - -Now that our robot knows what to do, let's get started: - - .start() diff --git a/examples/button/button.coffee b/examples/button/button.coffee deleted file mode 100644 index daee6bf..0000000 --- a/examples/button/button.coffee +++ /dev/null @@ -1,15 +0,0 @@ -Cylon = require('../..') - -Cylon.robot - connection: - name: 'arduino', adaptor: 'firmata', port: '/dev/ttyACM0' - - devices: [ - { name: 'led', driver: 'led', pin: 13 }, - { name: 'button', driver: 'button', pin: 2 } - ] - - work: (my) -> - my.button.on 'push', -> my.led.toggle() - -.start() diff --git a/examples/button/button.js b/examples/button/button.js deleted file mode 100644 index 885eff0..0000000 --- a/examples/button/button.js +++ /dev/null @@ -1,16 +0,0 @@ -var Cylon = require('../..'); - -Cylon.robot({ - connection: { name: 'arduino', adaptor: 'firmata', port: '/dev/ttyACM0' }, - - devices: [ - { name: 'led', driver: 'led', pin: 13 }, - { name: 'button', driver: 'button', pin: 2 } - ], - - work: function(my) { - my.button.on('push', function() { - my.led.toggle(); - }); - } -}).start(); diff --git a/examples/button/button.litcoffee b/examples/button/button.litcoffee deleted file mode 100644 index 93cbc81..0000000 --- a/examples/button/button.litcoffee +++ /dev/null @@ -1,37 +0,0 @@ -# Button - -For this example, we're going to be connecting to an Arduino, and when a putton -on it's pressed, an LED will be toggled. - -Before you start this example, make sure you've got the `cylon-firmata` module -installed. - -We'll get started by importing the Cylon module: - - Cylon = require '../..' - -Now that we have Cylon imported, let's start making our robot: - - Cylon.robot - -Our robot will have a connection to an Arduino, and communicate with it via the -Firmata protocol: - - connection: { name: 'arduino', adaptor: 'firmata', port: '/dev/ttyACM0' } - -This time, our robot will have two devices, an LED and a button: - - devices: [ - { name: 'led', driver: 'led', pin: 13 }, - { name: 'button', driver: 'button', pin: 2 } - ] - -Our robot has very simple work, it will just toggle the LED whenever the button -sends the 'push' event: - - work: (my) -> - my.button.on 'push', -> my.led.toggle() - -And with all that done, we can start our robot: - - .start() diff --git a/examples/led_brightness/led_brightness.coffee b/examples/led_brightness/led_brightness.coffee deleted file mode 100644 index 5f85d93..0000000 --- a/examples/led_brightness/led_brightness.coffee +++ /dev/null @@ -1,16 +0,0 @@ -Cylon = require '../..' - -Cylon.robot - connection: { name: 'arduino', adaptor: 'firmata', port: '/dev/ttyACM0' } - device: { name: 'led', driver: 'led', pin: 3 } - - work: (my) -> - brightness = 0 - fade = 5 - - every 0.05.seconds(), -> - brightness += fade - my.led.brightness(brightness) - fade = -fade if (brightness is 0) or (brightness is 255) - -.start() diff --git a/examples/led_brightness/led_brightness.js b/examples/led_brightness/led_brightness.js deleted file mode 100644 index 2e709ad..0000000 --- a/examples/led_brightness/led_brightness.js +++ /dev/null @@ -1,19 +0,0 @@ -var Cylon = require('../..'); - -Cylon.robot({ - connection: { name: 'arduino', adaptor: 'firmata', port: '/dev/ttyACM0' }, - device: { name: 'led', driver: 'led', pin: 3 }, - - work: function(my) { - var brightness = 0; - var fade = 5; - - every(0.05.seconds(), function() { - brightness += fade; - my.led.brightness(brightness); - if ((brightness === 0) || (brightness === 255)) { - fade = -fade; - } - }); - } -}).start(); diff --git a/examples/led_brightness/led_brightness.litcoffee b/examples/led_brightness/led_brightness.litcoffee deleted file mode 100644 index f825db2..0000000 --- a/examples/led_brightness/led_brightness.litcoffee +++ /dev/null @@ -1,43 +0,0 @@ -# LED Brightness - -For this example, we'll be using an LED on an Arduino board, and modifying it's -brightness to make it fade in and out. Before we start, make sure you've got the -`cylon-arduino` module installed. - -Let's start by importing Cylon: - - Cylon = require '../..' - -Once we've got that, we can start defining our robot: - - Cylon.robot - -We'll be using an Arduino, and communicating over the Firmata protocol. As well, -we'll let our robot know about the LED we'll be modifying, on pin #3 of the -Arduino. - - connection: { name: 'arduino', adaptor: 'firmata', port: '/dev/ttyACM0' } - device: { name: 'led', driver: 'led', pin: 3 } - -Next up, we'll define our robot's work: - - work: (my) -> - -We'll set some variables here: brightness will represent the LED's brightness, -from 1-255, and 'fade' will be the brightness change on each tick. - - brightness = 0 - fade = 5 - -Every 50 milliseconds, we'll be incrementing the brightness by `fade`'s value, -setting the LED to that brightness, and reversing `fade`'s value if brightness -hits 0 or 255. - - every 0.05.seconds(), -> - brightness += fade - my.led.brightness(brightness) - fade = -fade if (brightness is 0) or (brightness is 255) - -And with that done, we can now start our robot. - - .start() diff --git a/examples/motor/motor.coffee b/examples/motor/motor.coffee deleted file mode 100644 index 1a73c8f..0000000 --- a/examples/motor/motor.coffee +++ /dev/null @@ -1,17 +0,0 @@ -Cylon = require '../..' - -Cylon.robot - connection: { name: 'arduino', adaptor: 'firmata', port: '/dev/ttyACM0' } - device: { name: 'motor', driver: 'motor', pin: 3 } - - work: (my) -> - speed = 0 - increment = 5 - - every 0.05.seconds(), -> - speed += increment - my.motor.speed(speed) - console.log "Current Speed: #{my.motor.currentSpeed() }" - increment = -increment if (speed is 0) or (speed is 255) - -.start() diff --git a/examples/motor/motor.js b/examples/motor/motor.js deleted file mode 100644 index 8e5f2b3..0000000 --- a/examples/motor/motor.js +++ /dev/null @@ -1,20 +0,0 @@ -var Cylon = require('../..'); - -Cylon.robot({ - connection: { name: 'arduino', adaptor: 'firmata', port: '/dev/ttyACM0' }, - device: { name: 'motor', driver: 'motor', pin: 3 }, - - work: function(my) { - var speed = 0; - var increment = 5; - - every(0.05.seconds(), function() { - speed += increment; - my.motor.speed(speed); - - console.log("Current Speed: " + (my.motor.currentSpeed())); - - if ((speed === 0) || (speed === 255)) { increment = -increment; } - }); - } -}).start(); diff --git a/examples/motor/motor.litcoffee b/examples/motor/motor.litcoffee deleted file mode 100644 index 6b19c77..0000000 --- a/examples/motor/motor.litcoffee +++ /dev/null @@ -1,46 +0,0 @@ -# Motor - -For this example, similar in structure to the led_brightness example, we're -going to take an Arduino, and modify the speed of an attached motor such that it -continually speeds up and slows down. - -Before we get started, make sure to have the `cylon-arduino` module installed. - -First, let's require Cylon: - - Cylon = require '../..' - -Now we can start defining our robot: - - Cylon.robot - -We'll be connecting to an Ardunio, using the Firmata protocol, and a motor -attached to the Arduino on pin 3. - - connection: { name: 'arduino', adaptor: 'firmata', port: '/dev/ttyACM0' } - device: { name: 'motor', driver: 'motor', pin: 3 } - -We'll start defining the work for our robot next: - - work: (my) -> - -We'll define variables to hold our motor's speed, and the rate at which that -speed will change: - - speed = 0 - increment = 5 - -Every fifty milliseconds, we'll increment the `speed`, set the motor to run at -that speed, and log the speed we're running at to the console. We'll also make -sure to change the increment if the speed is at the upper/lower bounds of the -values supported: - - every 0.05.seconds(), -> - speed += increment - my.motor.speed(speed) - console.log "Current Speed: #{my.motor.currentSpeed() }" - increment = -increment if (speed is 0) or (speed is 255) - -And with all that done, we can now start our robot: - - .start() diff --git a/examples/mpl115a2/mpl115a2.coffee b/examples/mpl115a2/mpl115a2.coffee deleted file mode 100644 index 38f9602..0000000 --- a/examples/mpl115a2/mpl115a2.coffee +++ /dev/null @@ -1,16 +0,0 @@ -Cylon = require '../..' - -Cylon.robot - connection: - name: 'arduino', adaptor: 'firmata', port: '/dev/ttyACM0' - - device: - name: 'mpl115a2', driver: 'mpl115a2' - - work: (my) -> - my.mpl115a2.on 'start', -> - my.mpl115a2.getTemperature((data) -> - Logger.info "temperature #{data['temperature']}, pressure #{data['pressure']}" - ) - -.start() diff --git a/examples/mpl115a2/mpl115a2.js b/examples/mpl115a2/mpl115a2.js deleted file mode 100644 index 54ff003..0000000 --- a/examples/mpl115a2/mpl115a2.js +++ /dev/null @@ -1,15 +0,0 @@ -var Cylon = require('../..'); - -Cylon.robot({ - connection: { name: 'arduino', adaptor: 'firmata', port: '/dev/ttyACM0' }, - - device: { name: 'mpl115a2', driver: 'mpl115a2' }, - - work: function(my) { - my.mpl115a2.on('start', function() { - my.mpl115a2.getTemperature(function(data) { - Logger.info("temperature " + data['temperature'] + " pressure " + data['pressure']); - }); - }); - } -}).start(); diff --git a/examples/mpl115a2/mpl115a2.litcoffee b/examples/mpl115a2/mpl115a2.litcoffee deleted file mode 100644 index 0d068c1..0000000 --- a/examples/mpl115a2/mpl115a2.litcoffee +++ /dev/null @@ -1,31 +0,0 @@ -# MPL115A2 - -First, let's import Cylon: - - Cylon = require '../..' - -Now that we have Cylon imported, we can start defining our robot - - Cylon.robot - -Let's define the connections and devices: - - connection: - name: 'arduino', adaptor: 'firmata', port: '/dev/ttyACM0' - - device: - name: 'mpl115a2', driver: 'mpl115a2' - -Now that Cylon knows about the necessary hardware we're going to be using, we'll -tell it what work we want to do: - - work: (my) -> - my.mpl115a2.on 'start', -> - my.mpl115a2.getTemperature((data) -> - Logger.info "temperature #{data['temperature']}, pressure #{data['pressure']}" - ) - -Now that our robot knows what work to do, and the work it will be doing that -hardware with, we can start it: - - .start() diff --git a/examples/servo/servo.coffee b/examples/servo/servo.coffee deleted file mode 100644 index d192e04..0000000 --- a/examples/servo/servo.coffee +++ /dev/null @@ -1,26 +0,0 @@ -Cylon = require '../..' - -Cylon.robot - connection: - name: 'arduino', adaptor: 'firmata', port: '/dev/ttyACM0' - - # when declaring the servo driver you can add an optional range param - # (defaults to min: 30 max 150). This param sets limits for the angle, - # so sot he servo can't be damaged if it cannot move in the full 0-180 - # range, most servos are not capable of this. - device: - name: 'servo', driver: 'servo', pin: 3, range: { min: 30, max: 150} - - work: (my) -> - angle = 30 - increment = 40 - - every 1.seconds(), -> - angle += increment - my.servo.angle angle - - console.log "Current Angle: #{my.servo.currentAngle()}" - - increment = -increment if (angle is 30) or (angle is 150) - -.start() diff --git a/examples/servo/servo.js b/examples/servo/servo.js deleted file mode 100644 index 52698c2..0000000 --- a/examples/servo/servo.js +++ /dev/null @@ -1,20 +0,0 @@ -var Cylon = require('../..'); - -Cylon.robot({ - connection: { name: 'arduino', adaptor: 'firmata', port: '/dev/ttyACM0' }, - device: { name: 'servo', driver: 'servo', pin: 3, range: { min: 30, max: 150 } }, - - work: function(my) { - var angle = 30; - var increment = 40; - - every(1..seconds(), function() { - angle += increment; - my.servo.angle(angle); - - console.log("Current Angle: " + (my.servo.currentAngle())); - - if ((angle === 30) || (angle === 150)) { increment = -increment; } - }); - } -}).start(); diff --git a/examples/servo/servo.litcoffee b/examples/servo/servo.litcoffee deleted file mode 100644 index 89205dd..0000000 --- a/examples/servo/servo.litcoffee +++ /dev/null @@ -1,52 +0,0 @@ -# Servo - -For this example, similar in structure to the led_brightness example, we're -going to take an Arduino, and modify the angle of an attached servo such that -it's continually turning back and forth. - -Before we get started, make sure to have the `cylon-arduino` module installed. - -First, let's require Cylon: - - Cylon = require '../..' - -Now we can start defining our robot: - - Cylon.robot - -We'll be connecting to an Ardunio, using the Firmata protocol, and a servo -attached to the Arduino on pin 3. We have the option to pass an extra 'range' -param to the device, this param sets the min and max angle values. By default -this is set to min: 30, max: 150 to prevent damaging the servo when giving it -an angle outside the range it can cover. - - connection: - name: 'arduino', adaptor: 'firmata', port: '/dev/ttyACM0' - - device: - name: 'servo', driver: 'servo', pin: 3, range: { min: 30, max: 150} - -We'll start defining the work for our robot next: - - work: (my) -> - -We'll define variables to hold our servo's angle, and the rate at which that -angle will change: - - angle = 30 - increment = 40 - -Every second, we'll increment the `angle`, set the servo to run at that angle, -and log the angle we're running at to the console. We'll also make sure to -change the increment if the angle is at the upper/lower bounds of the values -supported: - - every 1.seconds(), -> - angle += increment - my.servo.angle(angle) - console.log "Current angle: #{my.servo.currentAngle() }" - increment = -increment if (angle is 30) or (angle is 150) - -And with all that done, we can now start our robot: - - .start()