XOD is a flow-based-programming tool for programming arduino. See https://xod.io && https://github.com/xodio/xod .
This (https://github.com/awgrover/xod_lib) is a library of nodes for it. Some may be useful. Some may be ill conceived.
Many are available as proper XOD libraries. If possible, install as libraries.
- Browse (https://xod.io/libs/) for "published" libraries, mine start with "awgrover"
- File menu, Add Library, type the name, like "awgrover/utils".
- should install.
This requires FortySevenEffects/arduino_midi_library. A bit of a pain to install:
- run arduino-ide
- sketch:include library:manage-libraries...
- search for "MIDI", find "MIDI Library by Forty Seven Effects"
- latest version (has worked with 4.3.1, report problems please)
- "install"
- done with arduion-ide, you can close it
- Find your "Arduino/libraries" folder.
- It's "~/Arduino/libraries" on linux. Please send info on OS's not listed here.
- Find your "XOD IDE/resources" directory. On my debian linux, it's '/opt/XOD IDE/resources/arduino-libraries'
- You have to create a link (shortcut) from the arduino-library to the xod-arduino-lib. On linux it's: sudo ln -s ~/Arduino/libraries/MIDI_Library '/opt/XOD IDE/resources/arduino-libraries'
- "Reload" in XOD
- Should be ready to go
I haven't "published" all of these yet, until then you have to put the 'awgrover' directory into the xod workspace lib manually.
- From this github repository https://github.com/awgrover/xod_lib
- Click "clone or download", click "Download zip"
- Open the downloaded zip, or let your OS just open it as it downloads.
- Navigate into the zip, inside 'lib'. So you can see the 'awgrover' directory.
- Find your xod workspace: run xod, choose File:Select Workspace. Note the "Current workspace directory". You can probabably select and copy it.
- Open your file-explorer, and navigate to the xod workspace.
- Make a directory "__lib__"
- Drag 'awgrover' from the zip to '__lib__' in the workspace.
- It's installed.
- Do a "reload" in XOD.
- My libs should be visible and usable.
More detailed documentation at NODES.md
constructor Default range is supposed ot be 2G, but get-range says 4G.
Allows to create feedback loops. Repeats a change of the input on the output right after the current transaction will complete.
Outputs true if IN1
= IN2
, and false otherwise
Allows values to pass through only if EN pin is set to true
Returns 2,4,8 (G).
(Not the range
bit values)
Outputs either input value depending on condition
values for range
of set-range.
Get the current xyz as -1..1.
Mapped from -range..range.
cf. read-xyz-g
Get the current xyz in m/sec^2
Get the current xyz in G's
(1 = 9.8m/s^2).
cf. read-zyz-accel
for 0..1 scale.
set the range 2,4,8 G. Higher sensitivey at 2G
constructor https://github.com/adafruit/Adafruit_NeoPixel Arduino: Adafruit_NeoPixel XOD: @/input-adafruitneopixel cpp postfix: adafruitneopixel
constructor https://github.com/adafruit/Adafruit_NeoPixel Arduino: Adafruit_NeoPixel XOD: @/input-adafruitneopixel cpp postfix: adafruitneopixel
convenience color: off
naive brightnes * (r,g,b)
val
over the range maps to brightness the color.
Use example-rgb-revelation to discover the color-order. Set one of the 1-x's to true. Set one of the 2-x's to true. The third is deduced.
Allows to create feedback loops. Repeats a change of the input on the output right after the current transaction will complete.
Outputs true if IN1
= IN2
, and false otherwise
Light up the first 3 pixels in Red, Green, Blue order. Nearest the Arduino should be Red, then Green, then Blue. This should help you decode the right RGB code to use (e.g. GRB, etc).
Light up the first pixel in order: OFF, Red, Green, Blue. Like the 3 pixel revelation, but this only requires 1 pixel. This should help you decode the right RGB code to use (e.g. GRB, etc).
Turn all pixels light green, one by one. Repeat. Based on the Adafruit Neopixel example "simple",
Get red, green, blue elements of rgb color
Allows values to pass through only if EN pin is set to true
Outputs either input value depending on condition
Outputs either input value depending on condition
composite rgb+white object 0..1 values a rgbw should auto calculate w
Set the bit resolution of the PWM (analogWrite) for SAMD21 and SAMD51 boards. i.e. analogWriteResolution(). Usually 8..16 bits.
Example showing bit-resolution on an LED. Read the comments for instructions.
Make a buffer of n bytes. Only at beginning of program. Allocates from the heap. You must check ERR: means not-enough-free-memory
Make a buffer of n bytes. Only at beginning of program. Allocates from the heap. You must check ERR: means not-enough-free-memory
Dump the buffer to the console if debugging is on
Allows to create feedback loops. Repeats a change of the input on the output right after the current transaction will complete.
Outputs true if IN1
= IN2
, and false otherwise
Fill the entire buffer with a value. Default fill is 0.
Allows values to pass through only if EN pin is set to true
Outputs either input value depending on condition
Convert anything into a pulse
Convert (each) true into a pulse. Compare with cast-boolean-to-pulse
From START to LIMIT by STEP each INC. Then reset to START. Either up or down. aka Sawtooth.
Count up/down on each INC pulse. Will not exceed MAX or go-below MIN. I.e. Count up to MAX. Won't output if nothing changes (e.g. RST when already MIN, or just changing STEP)
Simplified count: 0 to 1 by INC. Then repeat. Default is 256 steps suitable for LEDs etc. aka sawtooth.
counts from 0 to LIMIT in N steps. e.g. 0..1000 in 255 steps. sawtooth.
never implemented.
This button signals up & down. The signal is immediate (debounce inhibits signals for 20msec). Assumes normally-open switch. Does input-pullup.
Use xod/hardware/digital-input.
Reads digital signal value from board port. Can set input-pullup.
Outputs either input value depending on condition
generic equal should work.
Compares 2 strings, giving <, =, or > boolean output.
Classify v
by range
0 if < r1, "0..r1"
1 if >= r1, "r1..r2"
2 if >= r2, etc.
Bins the input-value: 0 if v < inf, 1 if v < r1, 2 if < r2, etc. NB: r's are decreasing
Exponential smoothing The result lags the value, smoothing out
Split the value: a + b = v
Bank-Select and Program-Change
Set the inputs, send the control change on pulse ("send").
For this to work, it must fire first. Putting in the top-left helps. Sets baud to 115200 for debugging
Real simple examples
Start/stop a note.
A button starts the note (push) and stops on release. Uses xod/common-hardware/button
Set the inputs, send on pulse ("send")
Set n least-significant bits
Block pulses until EN
Then RST
blocks again
Notes on passing/gating values/pulses/etc.
Set the bit corresponding to a pulse, on the least-significant end. e.g. p1,p2,p3 would set 00000111
On pulse, set the lsb. Cf. set-bits
Wait for all pulses to accumulate.
Produce n ticks/sec. aka Hz
Output the DATA on the console-log, possibly followed by a space. End-of-line is optional. So you can output more than 1 thing per line.
output "[time] prefix data". So you can see when it happened, what it's for (prefix). Unlike console-log, this outputs on prefix, or data. Of course, also on trig.
Use buffer
or flip-flop.
On pulse or boolean, copy the boolean out. Set always=false to only copy if the boolean has changed. Acts like casting pulse to boolean
use buffer
and pulse-on-change
On pulse or number, copy the number out. Set always=false to only copy if the number has changed. Acts like casting pulse to number
use buffer
and pulse-on-change
On pulse or text, copy the text out. Set always=false to only copy if the text has changed. Acts like casting pulse to text