Start Beaglebone Blue Roboticscape with python3
There is Python library that bindings with some of the functionality
of the
Robotics Cape library. However it supports only Python 3. Not all functions are supported. Currently supported functions are:
Then copy the program below in the file.
After that save the file by ctrl+x in keyboard, then choose yes. You can execute the code by:
You can see the red and green leds will blinking from your BBBlue.
In BBBlue the are other external sensors can be used such gps, humidity , motor encoder etc. To connect the external devices, you can check the list of BBBlue accessories here .
- MPU9250
- PWM motors
- Encoders
- LEDs
- Buttons
- GPIO inputs
Start Installation
You must also have python3 installed. If you have not installed
python3 yet type
sudo apt install python3 python3-pip
to install python3 and pip3.Starting with version 0.3,
rcpy is available from
PyPI. Just
type sudo pip3 install rcpy
All basic examples for rcpy you can get it here .For more documentation details you can refer to html and pdf.
Run Blink LED example
To run led example you can create a new python file by typing
sudo touch led_example.py
Then open the file by typing
sudo nano led_example.py
Then copy the program below in the file.
#!/usr/bin/env python3
# import rcpy libraries
import rcpy
import rcpy.gpio as gpio
import rcpy.button as button
import rcpy.led as led
#configure LEDs
rates = (0.5, 0.25, 0.1)
index = 0
# blink leds
led.red.on()
led.green.off()
blink_red = led.Blink(led.red, rates[index % len(rates)])
blink_green = led.Blink(led.green, rates[index % len(rates)])
blink_red.start()
blink_green.start()
# set state to rcpy.RUNNING
rcpy.set_state(rcpy.RUNNING)
After that save the file by ctrl+x in keyboard, then choose yes. You can execute the code by:
sudo python3 led_example.py
You can see the red and green leds will blinking from your BBBlue.
In BBBlue the are other external sensors can be used such gps, humidity , motor encoder etc. To connect the external devices, you can check the list of BBBlue accessories here .
Comments
Post a Comment