Skip to content

Instantly share code, notes, and snippets.

@dirkakrid
Forked from NiallEgan/networkSelect.py
Created October 29, 2016 16:37
Show Gist options
  • Save dirkakrid/446c9be8bed0d520ca2b090c55e43882 to your computer and use it in GitHub Desktop.
Save dirkakrid/446c9be8bed0d520ca2b090c55e43882 to your computer and use it in GitHub Desktop.
from microbit import *
networkID = 0 # Change the channel variable in the radio.configure to this
def selectNetwork(): # Call this function before calling anything else
global networkID
currentID = networkID
while True:
if button_a.is_pressed() and button_b.is_pressed():
networkID = currentID
display.scroll("Chan." + str(networkID) + "selected")
break
elif button_a.is_pressed():
currentID = (currentID - 1) % 10
display.show(str(currentID))
elif button_b.is_pressed():
currentID = (currentID + 1) % 10
display.show(str(currentID))
sleep(200)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment