Txting Program

Uses

radio, pins

Description

Do you know you can use the micro:bit to send and receive text message from other microbits?

../../_images/txt.png

Press pins 0 and 1 together to cycle through the characters, press button A to add characters to the message and press button B to send the completed message. The script requires only 2 micro:bits and both can send and receive via MicroPython’s radio module. However, more than 2 micro:bits can be used, just flash the same program onto multiple micro:bits and all of them can both send and receive.

Basic Task

  1. Setup and initialize the radio of the micro:bit. Listen to radio if there is incoming message.

  2. Create a list of letters and characters to send. Initialize also the message variables and the index to point which character is chosen. hint: use an array list to list out all characters from ‘A’ to ‘Z’, ‘0’ to ‘9’. Also create a a variable to store all the chosen characters to form a word.

  3. Create a while loop to do the following:

    1. if pin0 is touched, scroll forward through the character list
    2. if pin2 is touched, scroll backward through the character list
    3. if button a is pressed, choose the character and add to the previous characters chosen
    4. if button b is pressed, send all the characters chosen
    5. Break the while loop whether a button is pressed or not, so that microbit can listen for incoming msg