This is an Arduino library that lets you easily create nodes to stick on the wall. Each node will listen on an MQTT channel, and respond to commands. So a node with a servo motor in might respond to:
*`wiggle 30` - wiggle by 30 degrees a few times
*`goto 20` - move to 20 degrees
These commands can be put in via NodeRED, or through the USB Serial connection for testing.
These commands can be put in via NodeRED, or through the USB Serial connection for testing. There is a growing library of `Behaviours` that represent the different things the node might do.
## Installation
...
...
@@ -89,10 +89,32 @@ Behaviours are defined as classes. Each class has a unique name, and a construct
When the behaviour is then called, it is given the angle through which to wiggle, so the size of the wiggle can be controlled.
When the behaviour is then called, it is given the angle through which to wiggle, so the size of the wiggle can be controlled. So if the name is `wiggle`, it would be called by sending:
`wiggle 40`
The current set of behaviours and their parameters are:
| Constructor | Called with | Effect |
| ---- | ---- | ---- |
|`ServoWiggle( <servo_object>, <name>, <wiggle_speed> )`|`wiggle <int wiggle_angle>`|wiggles the servo|
|`ServoWiggle( <servo_object>, <name>, <wiggle_speed> )`|`<name> <int wiggle_angle>`|wiggles the servo|
|`ServoWiggle( <servo_object>, <name>, <wiggle_speed> )`|`<name> <int wiggle_angle>`|wiggles the servo|
|`ServoGoto( <servo_object>, <name> )`|`<name> <int angle>`|Moves the servo to that angle|
The next ones that are about to be written are something like the following:
| Constructor | Called with | Effect |
| ---- | ---- | ---- |
|`LEDNumber( <led_object>, <name>, <color>)`|`<name> <int num_leds>`|lights up that many LEDs on the object in the color given|
|`LEDSet( <led_object>, <name> )`|`<name> <int hue> <int brightness>`|Lights up the whole strip with the hue and brightness supplied|
|`ContinuousServo( <servo_object>, <name>, <speed> )`|`<name> <int time>`|Moves the continuous servo at the given speed for the given time. A negative time means move the other way.|
|`BallDrop( <servo_object>, <name>, <speed> )`|`<name>`|Drops a single ball. The <speed> parameter or something similar tunes it to work with different mechanisms.|
|`LinearSlide( <slide_object>, <name> )`|`<name> <int position>`|Moves the linear slide to the given position. Position should be consistent for different slides, so maybe a value from 1.1000 mapped to the length of the slide.|
_Please update this table as you generate new behaviours!_
## Creating behaviours
At first - make behaviours with your sketch, while you are testing them. See the examples for this!
When you've got something stable, add it to the library. If it fits within an existing file, add it to that (e.g. if it's another thing tthat Servos do, add it to `ServoBehaviours.h`). If it's a new kind of thing, then create a new file and add it in there. (Make sure you do the #IFNDEF stuff - ask if you don't know what that is!).