Skip to content

Instantly share code, notes, and snippets.

@graysonarts
Created December 15, 2014 18:54
Show Gist options
  • Save graysonarts/1becfbfe4c8c2231778e to your computer and use it in GitHub Desktop.
Save graysonarts/1becfbfe4c8c2231778e to your computer and use it in GitHub Desktop.
small example of the intermediate langauge that I'm considering building for my arduino led vm
%version 1
%numleds 5
%require imu
%green RGB(0,128,0)
%red RGB(128,0,0)
states {
state foo {
skipif imu.accel.x > 1
setall %green
fade
}
state bar {
pulse %green
skipif imu.accel.y > 1
set 1 %red
skipif imu.accel.z > 1
set 2 %green
ripple
}
state loop {
everypixel {
set i RGB(imu.orientation.y, imu.orientation.z, imu.orientation.x)
}
}
}
decisions {
imu.velocity.x > 0.1: foo
imu.velocity.y > 0.1 and imu.accel.y < 0.5: loop
imu.gesture.step: bar
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment