|
|
|
|
# Introduction
|
|
|
|
|
|
|
|
|
|
Please considers that the BeagleBone Black is a single board computer based on the Cortex-A8 CPU with embedded linux. The board has SDRAM and some low-level peripherals. Thus, at the end of the programming process, any used language will be converted to machine code to be properly interpreted by the CPU. Therefore, the used or selected programming language will depends on the final application usage.
|
|
|
|
|
|
|
|
|
|
# Connect the BeagleBoneBlack
|
|
|
|
|
|
|
|
|
|
First connect your BeagleBoneBlack (BBB) board by using the USB connection: `ssh debian@192.168.6.2` in GNU/Linux or MacOS, and `ssh debian@192.168.7.2` in Windows.
|
|
|
|
|
|
|
|
|
|
# Command line tests
|
|
|
|
|
|
|
|
|
|
First, considers that there are some LEDs already installed on the BBB board. These LEDs are used to let the user knows specific activity on the board, but that can be reprogrammed or used for user’s tasks.
|
|
|
|
|
|
|
|
|
|
![](https://beagleboard.org/static/uploads/LEDs.PNG)
|
|
|
|
|
|
|
|
|
|
Next, there is a system called **sysfs** that allows the OS to gives information and access to devices and drivers that will be only accessible through the Linux Kern space.
|
|
|
|
|
|
|
|
|
|
Note: this virtual file system is easy to use from Bash, but is not the best and efficient way.
|
|
|
|
|
|
|
|
|
|
At the command line, go to the `sysfs` system to access the LEDs:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
cd /sys/class/leds
|
|
|
|
|
ls -al
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
you must probably get an answer like this:
|
|
|
|
|
```
|
|
|
|
|
drwxr-xr-x 2 root root 0 Jan 1 00:00 .
|
|
|
|
|
drwxr-xr-x 48 root root 0 Jan 1 00:00 ..
|
|
|
|
|
lrwxrwxrwx 1 root root 0 Jan 1 00:00 beaglebone:green:usr0 -> ../../devices/ocp.2/gpio-leds.7/leds/beaglebone:green:usr0
|
|
|
|
|
lrwxrwxrwx 1 root root 0 Jan 1 00:00 beaglebone:green:usr1 -> ../../devices/ocp.2/gpio-leds.7/leds/beaglebone:green:usr1
|
|
|
|
|
lrwxrwxrwx 1 root root 0 Jan 1 00:00 beaglebone:green:usr2 -> ../../devices/ocp.2/gpio-leds.7/leds/beaglebone:green:usr2
|
|
|
|
|
lrwxrwxrwx 1 root root 0 Jan 1 00:00 beaglebone:green:usr3 -> ../../devices/ocp.2/gpio-leds.7/leds/beaglebone:green:usr3
|
|
|
|
|
```
|
|
|
|
|
there are some symbolic links the real directions and can be used to test our LED. Thus, go inside the folder/file `beaglebone:green:usr0` and prints out the contents of the file trigger by:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
cd beaglebone:green:usr0
|
|
|
|
|
more trigger
|
|
|
|
|
none nand-disk mmc0 mmc1 timer oneshot [heartbeat] backlight gpio cpu0 default-on transient
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
that means the `heartbeat` is the option that triggers the blinking activity.
|
|
|
|
|
|
|
|
|
|
Then, if we want to stop this triggering and manage the LED activity, let us follow the next steps:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
echo none > trigger
|
|
|
|
|
echo 1 > brightness
|
|
|
|
|
echo 0 > brightness
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
thus, you must probably observe that the LED turns on and off with the 1 or 0 values, respectively.
|
|
|
|
|
|
|
|
|
|
Can you try different options????
|
|
|
|
|
Can you handle the other LEDs????
|
|
|
|
|
Can you make it blink??
|
|
|
|
|
|
|
|
|
|
Try by yourself please!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|