MKPY101hello/helloclass 20250510
# description: Basic counter on python MILK-V DUO 256MB
# board: MILKV duo 256mb on soldered univaesal board
# soc: SG2020
# RISC-V CPU 1 x C906@1GHz + 1 x C906@700MHz
# Arm CPU 1 x Cortex-A53@1GHz
# MCU 8051@6KB SRAM, # NPU 1 TOPS@INT8
# SD card: DUOV1.1.0.img
# os cat /etc/os-release NAME=Buildroot VERSION=20240228-1428
# language python -V Python 3.9.5
# IDE: VS code with ssh ,scp on WSL ubuntu on windows11
# //# mkdir MKPY101hello
# C:\Users\miura\Documents\51MKPY100\MKPY101hello
# //$ wsl
# //> scp -O helloclass.py root@192.168.42.1:/root/MKPY101hello
# //> ssh root@192.168.42.1 , password: milkv
# //# cd MKPY101hello
# //# python helloclass.py
# //result
# //MKPY100hellopythonhello
# // {"codeId":MKPY100helloclass,"count":0}
# // {"codeId":MKPY100helloclass,"count":1}
#
import time
class Codeinfo:
def __init__(self, codeId,function):
self.codeId=codeId
self.function=function
self.count=0
def show(self):
print(f'{{"codeId":{self.codeId}{self.function},"count":{self.count}}}')
def counter(self):
self.count +=1
self.count=self.count%60
ci = Codeinfo("MKPY100","helloclass")
print(f"MKPY100hellopythonhello")
ci.show()
while 1 :
ci.counter()
ci.show()
time.sleep(1)