【发布时间】:2021-03-27 18:17:27
【问题描述】:
from microbit import *
import radio
radio.on()
radio.config(channel=8)
routing_table = { 'Alice': 8, 'Bob': 10, 'Charlie': 15 }
spy = 60
def forward_message(msg):
source, destination, payload = msg.split(':')
radio.config(channel=10)
radio.send(msg)
def forward_to_spy(msg):
source, destination, payload = msg.split(':')
radio.config(channel=60)
radio.send(msg)
while True:
msg = radio.receive()
if msg:
msg = radio.receive()
forward_message(msg)
forward_to_spy(msg)
ack = radio.receive()
while ack is None:
ack = radio.receive()
forward_message(ack)
每当我提交此代码时,它都会出现该错误,请有人帮助我。我正在尝试接收消息,然后将它们发送给他们需要去的人,同时还将消息发送给间谍,以参加 grok 课程。我已经坚持了很长时间了,所以再次请有人帮忙。
【问题讨论】: