Build a ‘mini’ school network.
Each student must build a classroom network with the following
- THREE student laptop micro-bits
- ONE classroom WAP micro-bit
- ONE SWITCH micro-bit
LAPTOP Micro-Bits
Each laptop micro-bit must be able to
- Have a unique channel for that classroom
- Send a message to a specific Laptop through the WAP
- Display a message received
WAP Micro-bit
WAP micro-bit must be able to
- Have a unique channel
- Receive a message from a laptop in its classroom and either
1. Send the message to a specific laptop in its classroom
2. Send the message to the switch for laptops in other classrooms - Receive a message from a switch and
1. Send the message to a specific laptop in its classroom
SWITCH Micro-bit
SWITCH micro-bit must be able to
- Have a unique channel
- Receive a message from a WAP and
1. Send the message to the correct WAP in another classroom
Routing Table
Each message sent needs to include the following information
- Sender ID ( ‘A5’ , ‘M15’, ‘E25’)
- Destination (‘M17’)
- Payload
from microbit import *
import radio
# message components
# { senderID, desinationID, payload }
# { 'A7', 'E28', 'Hi'}
wap_routing_table = { 'A': 5, 'M': 15, 'E': 25}
# Turn on Radio
radio.on()
radio.config(channel=1)
# wait for a message
while True:
msg = radio.receive()
if msg:
senderID, destinationID, payload = msg.split(':')
# Get First Letter of senderID
senderClass = senderID[0]
# Get First Letter of destinationID
destinationClass = destinationID[0]
# Get number from destinationID
destinationNumber = int(destinationID[1:])
WAP_channel = wap_routing_table[destinationClass]
radio.config(channel=WAP_channel)
radio.send(msg)
radio.config(channel=1)