A Robit package in python, for the ElecFreaks kit Robit.
from microbit import *
from Robit_motor import Robit
from random import randint
theBoard = Robit()
while True:
red = randint(0, 60)
green = randint(0, 60)
blue = randint(0, 60)
if button_a.is_pressed():
print(theBoard.LightLevel())
theBoard.MotorRun(1, 50)
theBoard.MotorRun(2, -50)
theBoard.LedRGBLeft(red, green, blue)
theBoard.SoundR2D2()
elif button_b.is_pressed():
theBoard.MotorRun(1, -50)
theBoard.MotorRun(2, 50)
theBoard.LedRGBRight(red, green, blue)
else:
theBoard.MotorStop(1)
theBoard.MotorStop(2)
theBoard.LedRGBRight(0, 0, 0)
theBoard.LedRGBLeft(0, 0, 0)
from microbit import *
from Robit_servo import Robit
theBoard = Robit()
while True:
if button_a.is_pressed():
theBoard.Servo(1, 50)
display.show(Image.YES)
theBoard.LedRGBLeft(10,50,30)
elif button_b.is_pressed():
theBoard.Servo(1, 180)
display.show(Image.NO)
theBoard.LedRGBRight(100,50,60)
theBoard.SoundR2D2()
else:
theBoard.LedRGBLeft(0,0,0)
theBoard.LedRGBRight(0,0,0)
theBoard.Servo(1, 0)
from microbit import *
import Robit_stepper
theBoard = Robit_stepper.Robit()
while True:
if button_a.is_pressed():
theBoard.StepperDegree(1, 500, "W")
elif button_b.is_pressed():
theBoard.StepperDegree(1, -500, "W")
else:
theBoard.MotorStopAll()
MIT
for BBC micro:bit embeded on Robit board