constructor Default range is supposed ot be 2G, but get-range says 4G.
id : number. -1 id default, and usual. What is it for?
alt_addr : boolean. 29 (1Dh) is default and usual address. Set to true to use alternate 28 (1Ch), and pull
A
pin to ground.
adafruitmma8451 : self.
exist : boolean. True if it was detected False if not detected
done : pulse. Pulse if exists and when setup
Allows to create feedback loops. Repeats a change of the input on the output right after the current transaction will complete.
none
none
Outputs true if IN1
= IN2
, and false otherwise
none
OUT : boolean.
none
none
Allows values to pass through only if EN pin is set to true
EN : boolean. Whether values should pass through
none
trigger : pulse.
val : number.
done : pulse.
trigger : pulse.
val : number.
done : pulse.
Returns 2,4,8 (G).
(Not the range
bit values)
trigger : pulse.
val : number. 2, 4, or 8 (G)
done : pulse.
Outputs either input value depending on condition
COND : boolean. Condition value
none
values for range
of set-range.
none
2g : number.
4g : number.
8g : number.
Get the current xyz as -1..1.
Mapped from -range..range.
cf. read-xyz-g
trigger : pulse.
x : number. -1..1
y : number. -1..1
z : number. -1..1
done : pulse.
Get the current xyz in m/sec^2
trigger : pulse.
x : number. x in m/s^2
y : number. y in m/s^2
z : number. z in m/s^2
done : pulse.
Get the current xyz in G's
(1 = 9.8m/s^2).
cf. read-zyz-accel
for 0..1 scale.
trigger : pulse.
x : number. x in G units
y : number. y in G units
z : number. z in G units
done : pulse.
none
none
dataRate : number.
trigger : pulse.
done : pulse.
set the range 2,4,8 G. Higher sensitivey at 2G
range : number.
trigger : pulse.
done : pulse.
constructor https://github.com/adafruit/Adafruit_NeoPixel Arduino: Adafruit_NeoPixel XOD: @/input-adafruitneopixel cpp postfix: adafruitneopixel
n : number.
p : number.
t : number.
adafruitneopixel : self.
done : pulse.
constructor https://github.com/adafruit/Adafruit_NeoPixel Arduino: Adafruit_NeoPixel XOD: @/input-adafruitneopixel cpp postfix: adafruitneopixel
none
done : pulse.
trigger : pulse.
done : pulse.
convenience color: off
none
none
naive brightnes * (r,g,b)
brightness : number.
none
trigger : pulse.
val : boolean.
done : pulse.
trigger : pulse.
done : pulse.
val
over the range maps to brightness the color.
val : number.
min-v : number.
max-v : number.
none
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.
1-red : boolean. Set to true if the 1st color is red
1-green : boolean. Set to true if the 1st color is green
1-blue : boolean. Set to true if the 1st color is blue
2-red : boolean. Set to true if the 2nd color is red
2-green : boolean. Set to true if the 2nd color is green
2-blue : boolean. Set to true if the 2nd color is blue
t : number. color-order-code for the constructor's
t
input
Allows to create feedback loops. Repeats a change of the input on the output right after the current transaction will complete.
none
none
Outputs true if IN1
= IN2
, and false otherwise
none
OUT : boolean.
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).
none
none
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).
none
none
Turn all pixels light green, one by one. Repeat. Based on the Adafruit Neopixel example "simple",
none
none
Get red, green, blue elements of rgb color
none
red : number.
green : number.
blue : number.
trigger : pulse.
val : number.
done : pulse.
Allows values to pass through only if EN pin is set to true
EN : boolean. Whether values should pass through
none
trigger : pulse.
val : number.
done : pulse.
trigger : pulse.
val : number.
done : pulse.
trigger : pulse.
val : number.
done : pulse.
trigger : pulse.
val : number.
done : pulse.
Outputs either input value depending on condition
COND : boolean. Condition value
none
Outputs either input value depending on condition
COND : boolean. Condition value
none
trigger : pulse.
val : number.
done : pulse.
none
none
composite rgb+white object 0..1 values a rgbw should auto calculate w
red : number.
green : number.
blue : number.
color : self.
p : number.
trigger : pulse.
done : pulse.
n : number.
r : number.
g : number.
b : number.
trigger : pulse.
done : pulse.
n : number.
r : number.
g : number.
b : number.
trigger : pulse.
done : pulse.
trigger : pulse.
done : pulse.
trigger : pulse.
val : number.
done : pulse.
n : number.
trigger : pulse.
done : pulse.
t : number.
trigger : pulse.
done : pulse.
Set the bit resolution of the PWM (analogWrite) for SAMD21 and SAMD51 boards. i.e. analogWriteResolution(). Usually 8..16 bits.
BITS : number. 8,10,12,14,16 bits, depending on hardware
READY : pulse. To signal that the change has been made. Error if board doesn't support analogWriteResolution()
Example showing bit-resolution on an LED. Read the comments for instructions.
none
none
Make a buffer of n bytes. Only at beginning of program. Allocates from the heap. You must check ERR: means not-enough-free-memory
bytes : number. size of buffer in bytes
buffer1 : self.
done : pulse. did it
ERR : pulse.
Make a buffer of n bytes. Only at beginning of program. Allocates from the heap. You must check ERR: means not-enough-free-memory
bytes : number. size of buffer in bytes
buffer1 : self.
done : pulse. did it
ERR : pulse.
Dump the buffer to the console if debugging is on
mark : string.
trigger : pulse.
none
Allows to create feedback loops. Repeats a change of the input on the output right after the current transaction will complete.
none
none
Outputs true if IN1
= IN2
, and false otherwise
none
OUT : boolean.
none
none
Fill the entire buffer with a value. Default fill is 0.
value : byte. Fills the buffer with this byte.
trigger : pulse.
done : pulse.
Allows values to pass through only if EN pin is set to true
EN : boolean. Whether values should pass through
none
i : number.
trigger : pulse.
val : byte.
done : pulse.
ERR : pulse.
i : number.
trigger : pulse.
val : number.
done : pulse.
ERR : pulse.
Outputs either input value depending on condition
COND : boolean. Condition value
none
none
val : number.
value : byte.
i : number.
trigger : pulse.
done : pulse.
ERR : pulse.
value : number.
i : number.
trigger : pulse.
done : pulse.
ERR : pulse.
none
none
none
none
val : number.
err : pulse.
val-out : number.
done : pulse.
ERR : string.
Convert anything into a pulse
data : string. Actually takes any
pulse : pulse.
Convert (each) true into a pulse. Compare with cast-boolean-to-pulse
bool : boolean. boolean, or Number (0=false, everything else is true)
pulse : pulse.
From START to LIMIT by STEP each INC. Then reset to START. Either up or down. aka Sawtooth.
START : number (0). Start the sequence at this value.
STEP : number (0.00390625). Amount to change on each increment. Automatically deals with counting down.
LIMIT : number (1). Limit of change, goes back to START on the next increment.
INC : pulse. Triggers a single change.
RST : pulse. Resets the sequence to START.
COUNT : number. The current value.
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)
MIN : number. Minimum value of OUT. Stops counting down when it hits this value. Will reset to this value on RST if STEP is positive.
STEP : number (0.00392157). Value to add on each INC pulse. Use a negative value (e.g. -1) to make decrements. Default is 0..1 in 255 steps of .00392156 suitable for PWM
INC : pulse. On a pulse, add the STEP to the current OUT. Thus negative decrements. There will be no output if the OUT doesn't change. e.g. A STEP of 0.
MAX : number (1). Maximum value of OUT. Stops counting up when it hits this value. Will reset to this value on RST if STEP is negative.
RST : pulse (ON_BOOT). Reset the output to MIN. NB: the default of "on boot" will cause OUT to be MIN on the first transaction. (if STEP is negative, then it will use MAX for above).
OUT : number. The changing value, never below MIN or above MAX. Will not output unless this value changes.
Simplified count: 0 to 1 by INC. Then repeat. Default is 256 steps suitable for LEDs etc. aka sawtooth.
STEP : number (0.256).
INC : pulse.
none
counts from 0 to LIMIT in N steps. e.g. 0..1000 in 255 steps. sawtooth.
LIMIT : number (1).
STEPS : number (255).
INC : pulse.
COUNT : number.
never implemented.
This button signals up & down. The signal is immediate (debounce inhibits signals for 20msec). Assumes normally-open switch. Does input-pullup.
port : number. any pin. other side of switch should be to ground
close : pulse. pulse when button is pushed (closed)
open : pulse. pulse when button is released (opened)
Use xod/hardware/digital-input.
Reads digital signal value from board port. Can set input-pullup.
PORT : number. Number of a board digital port to read from
PULLUP : boolean. use INPUT_PULLUP, i.e. pin is held high by a large value resistor (~20k ohm). False is default INPUT behavior
UPD : pulse. Triggers new read
VAL : number. The latest read value: 0 or 1
Outputs either input value depending on condition
COND : boolean. Condition value
T : string. Value to be output if condition is true
F : string. Value to be output if condition is false
R : string. Outputs value of
T
ifCOND
is true, andF
otherwise
generic equal should work.
Compares 2 strings, giving <, =, or > boolean output.
a : string. String 1 to compare
b : string. string 2 to compare
less : boolean.
eq : boolean.
greater : boolean.
Classify v
by range
0 if < r1, "0..r1"
1 if >= r1, "r1..r2"
2 if >= r2, etc.
v : number. value to bin
bin0 : number. The first bin (v < r1 or -inf..r1) will be this. Usually just defualt 0.
r1 : number. Increasing values for the bins. nb: v >= r1
bin : number. Which r1 is this >= than?
Bins the input-value: 0 if v < inf, 1 if v < r1, 2 if < r2, etc. NB: r's are decreasing
v : number. value to bin
bin0 : number. The first bin (v < inf) will be this, so v < r1 == this+1
r1 : number. Decreasing values for the bins
bin : number. Which r1 is this less than?
Exponential smoothing The result lags the value, smoothing out
n : number. 1/α where α is the smoothing factor analogous to
n
samples. Takes about 3n samples to reach 95% of a stable value.
v : number. each value
smooth : number.
** : number.**
** : number.**
Split the value: a + b = v
v : number.
split : number. 0..1
a : number. split * v
b : number. (1-split) * v : the rest of the value
Bank-Select and Program-Change
Prg# : number (1). Progrm Change Number
MSB : number. MSB for bank select
LSB : number. LSB for bank select
Ch : number (1). MIDI Channel
send : pulse. Send when triggered
sent : pulse. Pulse when sent
Set the inputs, send the control change on pulse ("send").
CC : number (3). Controller Number
Val : number. Controller Value
Ch : number (1). MIDI Channel
send : pulse. Send when triggered
sent : pulse. pulse when sent
For this to work, it must fire first. Putting in the top-left helps. Sets baud to 115200 for debugging
dumy : pulse (ON_BOOT).
none
none
none
Real simple examples
none
none
none
none
Start/stop a note.
Num : number (60). Note number
Ch : number (1). MIDI Channel
VelOn : number (64). Velocity Level (on). often volume, depends on the instrument
VelOff : number. some instruments respond to off-velocity, or have decay. Normally 0
play : pulse. Send NoteOn when triggered
stop : pulse. Send NoteOff when triggered
none
A button starts the note (push) and stops on release. Uses xod/common-hardware/button
port : number (10). pin for button
No. : number (60). Note Number
Ch : number (1). MIDI Channel
VelOn : number (64). Velocity Level (on). Often volume, depends on the instrument
VelOff : number. some instruments respond to off-velocity, or have decay. Normally 0
none
Set the inputs, send on pulse ("send")
Prg : number (1). Program Change Number
Ch : number (1). MIDI Channel
send : pulse. Send when triggered
sent : pulse. Pulse when sent
Set n least-significant bits
count : number. number of bits to set, from least-significant end, Max is 8
bit-mask : byte.
none
none
Block pulses until EN
Then RST
blocks again
EN : pulse. Start passing pulses
RST : pulse. Stop passing pulses
p1 : pulse.
p2 : pulse.
pulse : pulse.
Notes on passing/gating values/pulses/etc.
** : number.**
** : number.**
** : number.**
** : pulse.**
** : pulse.**
** : pulse.**
** : number.**
** : number.**
** : number.**
Set the bit corresponding to a pulse, on the least-significant end. e.g. p1,p2,p3 would set 00000111
x-bits : byte. Intended for internal use, necessary for the variadic behavior. Should be left as 00h.
x-bit-count : number. Intended for internal use, necessary for the variadic behavior. Should be left as 00h.
rst : pulse. Forget pulses, Output reverts to input (00h). Next pulses set bits again.
p1 : pulse. Sets the corresponding bit, from the least-significant-end. Maximum eight pulse-inputs.
bits : byte. The set bits, Initially 0, Updated when
bits
changes, or onrst
, or on one of the pulses.
bit-count : number. Number of pulse-inputs, i.e. number of relevant bits.
x-rst : pulse. Repeats the
rst
Necessary for variadic behavior.
On pulse, set the lsb. Cf. set-bits
bits : byte. Value to modify.
set : pulse. Emit the input-value with lsb set, If input changes later, set its lsb.
rst : pulse. Forget the
set
pulse, Emit the input-value (if it is different from last emitted value)
new-bits : byte. Initially a copy of the input, Only emitted if it would be a changed value.
Wait for all pulses to accumulate.
rst : pulse.
_ : pulse.
bits_sofar : byte. start at 0
bit_ct_sofar : number. start at 0
p1 : pulse.
all : pulse.
bits : byte.
bit_count : number.
none
none
Produce n ticks/sec. aka Hz
Hz : number (1). ticks/second
RST : pulse. Resets clock. Hz starts from 'now'. e.g. Synchronize.
tick : pulse.
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.
data : string.
space : boolean (1). Puts a space after DATA
EOL : boolean.
chain : pulse. pulses on output to chain these
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.
prefix : string (). A label before the data: ts] prefix data Convenience for adding a label.
data : string. Any data except pulse. Log the data on update.
trig : pulse. also triggers output of current values
none
SEND : pulse. Triggers write of a string into UART
x_err : pulse. for variadic, leave unconnected
DATA : string. String to be sent into UART. Could contain "\r\n" symbols to sent few lines.
DONE : pulse. Pulses when all String has been written
ERR : pulse. Pulses when something went wrong and all string was not written
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
boolean : boolean. The boolean to copy
pulse : pulse. Also copy on a pulse
always : boolean. On pulse or boolean, copy 'boolean'. If false, only copy when 'boolean' changes.
copy : boolean. The 'boolean'
trig : pulse.
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
number : number. The number to copy
pulse : pulse. Also copy on a pulse
always : boolean. On pulse or number, copy 'number'. If false, only copy when 'number' changes.
copy : number. The 'number'
trig : pulse.
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
text : string. The text to copy
pulse : pulse. Also copy on a pulse
always : boolean. On pulse or text, copy 'text'. If false, only copy when 'text' changes.
copy : string. The 'text'
trig : pulse.