This primer will take you through the steps to learning how to control your CodeBot with Python. All you need is your CodeBot and a Chrome Web Browser.
Ready to get started? Open your browser to make.firialabs.com and let’s do this!
1. Turn on a User LED
Blinking an LED is often the first “Hello World” program for embedded devices like CodeBot. As a first step, let’s light one of the “User” LEDs in the center of the ‘bot.
Type the following into CodeSpace. Remember, you don’t have to type in the
# Very first CodeBot program - Lights ON! from botcore import * leds.user_num(0, True)
The code above uses the
botcore module, which provides functions to control and monitor all the hardware
on CodeBot. Take a look at the documentation for
botcore.CB_LEDs.user_num to see how this function works.
2. A sequence of LEDs
Next try lighting more of the User LEDs, as shown below.
from botcore import * import time leds.user_num(0, True) time.sleep(1.0) leds.user_num(1, True) time.sleep(1.0) leds.user_num(2, True) time.sleep(1.0) leds.user_num(3, True)