Microcontroller Tutorials

Arduino, Raspberry Pi, PIC, Beaglebone Resources

Input to BeagleBone Black with BoneScript

by Roland Pelayo

Using a Button

As you’ve noticed, the functions in bonescript are similar to Arduino’s. If we are to use an input device such as a button, switch, etc, we only need to change the direction using pinMode:

 

The script below reads the state of a button attached to P9_11. If that button is pressed, the LED at P9_12 will turn on. Otherwise, the LED remains off.

Beaglebone Black Button