Music city coders continued with how to trigger event and that would display different images. For example, button pressed
from microbit import *
while True:
if button_a.is_pressed():
display.show(Image.HAPPY)
elif button_b.is_pressed():
display.show(Image.ANGRY)
else:
display.show(Image.SAD)
Then continued with ticklish microbit by touching different pins
from microbit import *
while True:
if pin0.is_touched():
display.show(Image.HAPPY)
elif pin1.is_touched():
display.show(Image.ANGRY)
Random name picker app
from microbit import * import random names = ["varshini","mithu","tanush","prajeeth","akhilan","nila","shruthi"] display.scroll(random.choice(names))
Finally we also checked microbit accelerometer
from microbit import *
while True:
reading = accelerometer.get_x()
if reading > 20:
display.show("R")
elif reading < -20:
display.show("L")
else:
display.show("-")
