import os, sys, io
import M5
from M5 import *
from m5espnow import M5ESPNow
import time
espnow_0 = None
mac = None
str2 = None
def setup():
global espnow_0, mac, str2
M5.begin()
espnow_0 = M5ESPNow(0)
def loop():
global espnow_0, mac, str2
M5.update()
mac = espnow_0.get_mac(0)
str2 = espnow_0._bytes_to_hex_str(mac)
print(str2)
time.sleep(5)
if __name__ == '__main__':
try:
setup()
while True:
loop()
except (Exception, KeyboardInterrupt) as e:
try:
from utility import print_error_msg
print_error_msg(e)
except ImportError:
print("please update to latest firmware")