ADC, GPIO, PWM, UARTs, and more with Node.js on the BeagleBone Black.
- LEDs - Light Emitting Diodes
- Buttons and Switches
- ADC - Analog to Digital Conversion
- GPIO - General Purpose Input Output
- PWM - Pulse Width Modulation
- UART - Serial Communication
$ npm install bot-io
News & Updates
bot-io v1.0.0 - March 28th 2016
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;
PWM - Pulse Width Modulation
Fade an LED on and off once per second.
var bot =led = botpinsp9_42;led;
ADC - Analog to Digital Conversion
Determine the ambient light level with an analog ambient light sensor.
var bot =ain = botpinsp9_36;ain;
- Ain - Analog to Digital Conversion
- Button - Buttons and Switches
- Gpio - General Purpose Input Output
- Led - Light Emitting Diodes
- Pwm - Pulse Width Modulation
- Uart - Serial Communication
- once - One Time Listener
Tested on a BeagleBone Black rev. A5C with
- Debian Jessie 8.3 2016-03-20, Kernel 4.1.18-ti-r53, and Node.js v0.12.12