ADC, GPIO, PWM, UARTs, and more with Node.js on the BeagleBone Black.
$ npm install bot-io
bot-io v1.0.0 dropped support for the 3.8.x kernel and added support for the 4.1.x-ti kernel. bot-io v0.1.1 was the last version of bot-io that supported the 3.8.x kernel. All versions of bot-io require cape manager support.
For further information about breaking changes introduced with v1.0.0 see Migrating from bot-io v0.1.1 to v1.0.0
Note that cape_universal should be disabled when using bot-io. This can be achieved by editing /boot/uEnv.txt and modifing the following line
cmdline=coherent_pool=1M quiet cape_universal=enable
Let's start off with something simple that doesn't require any hadrware other than the BeagleBone Black itself. The following example will blink onboard user LED0 at a frequency of 1Hz.
var bot =led0 = botLedUSR0;led0;
The next example heartbeats all four onboard user LEDs at 100Hz.
var bot =Led = botLedleds;leds = LedUSR0 LedUSR1 LedUSR2 LedUSR3;bot;
Toggle the state of an LED every time a button is pressed.
var bot =button = botpinsp9_24led = botpinsp9_26ledState = 0;button;
Fade an LED on and off once per second.
var bot =led = botpinsp9_42;led;
Determine the ambient light level with an analog ambient light sensor.
var bot =ain = botpinsp9_36;ain;
Tested on a BeagleBone Black rev. A5C with