Alex Glow
Published

Bikey McBikeface Face

My Stupid Hackathon project: random emotional feedback for other drivers!

EasyFull instructions provided30 minutes360
Bikey McBikeface Face

Things used in this project

Hardware components

BBC micro:bit board
BBC micro:bit board
×2
5V power supply (generic)
Like a phone charger.
×2
USB-A to Micro-USB Cable
USB-A to Micro-USB Cable
×2
White paper
Diffuse the LEDs by taping white paper over them.
×1

Software apps and online services

Mu editor
Editor for MicroPython.

Story

Read more

Code

bikeyface.py

MicroPython
Put this code on both micro:bits using the Mu editor.
# A micro:bit Firefly
# By Nicholas H.Tollervey. Released to the public domain. Modded by Alex Glow to display random emotions on your bike.
import radio
import random
from microbit import display, Image, button_a, sleep

faces = [Image.HAPPY, Image.SAD, Image.CONFUSED, Image.ANGRY, Image.ASLEEP, Image.SURPRISED, Image.SILLY, Image.FABULOUS, Image.MEH, Image.HEART, Image.SKULL ]

# The radio won't work unless it's switched on.
radio.on()

# Event loop.
while True:
    # Button A sends a "flash" message.
    if button_a.is_pressed():
        radio.send('flash')  # a-ha
        display.show(random.choice(faces))
    # Read any incoming messages.
    incoming = radio.receive()
    if incoming == 'flash':
        display.show(random.choice(faces))  # of course this does not actually display the same face as your "signal" micro:bit

Credits

Alex Glow

Alex Glow

72 projects • 667 followers
The Hackster team's resident Hardware Nerd. I like robots, music, EEG, wearables, and languages. FIRST Robotics kid.
Contact

Comments

Add projectSign up / LoginAbout BBC micro:bit