Skip to content

Instantly share code, notes, and snippets.

@inderpreet
Created April 28, 2019 18:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save inderpreet/cc42817ee0c7f03bc86841ff4b7d016f to your computer and use it in GitHub Desktop.
Save inderpreet/cc42817ee0c7f03bc86841ff4b7d016f to your computer and use it in GitHub Desktop.
Contains Code to allow BLE control over GPIOs
"""
@file bbc_recieve
@brief BBC microbit Receiver By Inderpreet Singh
"""
import radio
import random
from microbit import display, Image, button_a, sleep
radio.on()
def mOn():
pin0.write_digital(1)
def mOff():
pin0.write_digital(0)
def lOn():
pin1.write_digital(1)
def lOff():
pin1.write_digital(0)
# Event loop.
while True:
# Incomming
incoming = radio.receive()
if incoming == 'm-on':
mOn()
elif incoming == 'm-off':
mOff()
elif incoming =='l-on':
lOn()
elif incoming = 'l-off':
lOff()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment