Thu. Jan 9th, 2025
import os, sys, io
import M5
from M5 import *
from squarer import squarer
from AVERAGER import AVERAGER
import time



SQUARER = None
averager_0 = None


def setup():
  global SQUARER, averager_0

  M5.begin()
  SQUARER = squarer()
  averager_0 = AVERAGER()


def loop():
  global SQUARER, averager_0
  M5.update()
  print(str((SQUARER.squared(5))))
  time.sleep(5)
  print(str((averager_0.average(10, 15))))
  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")

By admin

Leave a Reply

Your email address will not be published. Required fields are marked *