Update: 更新micropython_esp32c2

This commit is contained in:
王立帮
2024-07-19 21:56:30 +08:00
parent 7f7743d1cd
commit 35795a68c4
4 changed files with 45 additions and 24 deletions

View File

@@ -0,0 +1,23 @@
"""
MINI G2 -MixGo MINI EXT G2
MicroPython library for the MINI G2 (Expansion board for MixGo MINI)
=======================================================
@dahanzimin From the Mixly Team
"""
import gc
from machine import Pin, SoftI2C
'''i2c-extboard'''
ext_i2c = SoftI2C(scl=Pin(7), sda=Pin(8), freq=400000)
'''RFID_Sensor'''
try :
import rc522
onboard_rfid = rc522.RC522(ext_i2c)
except Exception as e:
print("Warning: Failed to communicate with SI522A (RFID) or",e)
'''Reclaim memory'''
gc.collect()

View File

@@ -3,8 +3,6 @@ mixgo_mini onboard resources
Micropython library for the mixgo_mini onboard resources Micropython library for the mixgo_mini onboard resources
======================================================= =======================================================
#Preliminary composition 20240618
@dahanzimin From the Mixly Team @dahanzimin From the Mixly Team
""" """
import time, gc import time, gc
@@ -19,7 +17,7 @@ rtc_clock = RTC()
'''I2C-onboard''' '''I2C-onboard'''
onboard_i2c = SoftI2C(scl=Pin(10), sda=Pin(18), freq=400000) onboard_i2c = SoftI2C(scl=Pin(10), sda=Pin(18), freq=400000)
onboard_i2c_scan = onboard_i2c.scan() #onboard_i2c_scan = onboard_i2c.scan()
'''ACC-Sensor''' '''ACC-Sensor'''
try : try :
@@ -44,28 +42,28 @@ except Exception as e:
print("Warning: Failed to communicate with BOT035 (Coprocessor) or",e) print("Warning: Failed to communicate with BOT035 (Coprocessor) or",e)
'''BPS-Sensor''' '''BPS-Sensor'''
if 0x77 in onboard_i2c_scan: # if 0x77 in onboard_i2c_scan:
try : # try :
import spl06_001 # import spl06_001
onboard_bps = spl06_001.SPL06(onboard_i2c) # onboard_bps = spl06_001.SPL06(onboard_i2c)
except Exception as e: # except Exception as e:
print("Warning: Failed to communicate with SPL06-001 (BPS) or",e) # print("Warning: Failed to communicate with SPL06-001 (BPS) or",e)
'''THS-Sensor''' '''THS-Sensor'''
if 0x70 in onboard_i2c_scan: # if 0x70 in onboard_i2c_scan:
try : # try :
import shtc3 # import shtc3
onboard_ths = shtc3.SHTC3(onboard_i2c) # onboard_ths = shtc3.SHTC3(onboard_i2c)
except Exception as e: # except Exception as e:
print("Warning: Failed to communicate with GXHTC3 (THS) or",e) # print("Warning: Failed to communicate with GXHTC3 (THS) or",e)
'''MGS-Sensor''' '''MGS-Sensor'''
if 0x30 in onboard_i2c_scan: # if 0x30 in onboard_i2c_scan:
try : # try :
import mmc5603 # import mmc5603
onboard_mgs = mmc5603.MMC5603(onboard_i2c) # onboard_mgs = mmc5603.MMC5603(onboard_i2c)
except Exception as e: # except Exception as e:
print("Warning: Failed to communicate with MMC5603 (MGS) or",e) # print("Warning: Failed to communicate with MMC5603 (MGS) or",e)
'''MCU_temperature''' '''MCU_temperature'''
def onboard_temperature(): def onboard_temperature():

View File

@@ -37,9 +37,9 @@ class NeoPixel:
def write(self): def write(self):
self.pin.init(self.pin.OUT) self.pin.init(self.pin.OUT)
bitstream(self.pin, 0, self.timing, self.rgb_buf) for _ in range(2):
sleep_us(50) bitstream(self.pin, 0, self.timing, self.rgb_buf)
bitstream(self.pin, 0, self.timing, self.rgb_buf) sleep_us(50)
self.pin.init(self.pin.IN) self.pin.init(self.pin.IN)
def color_chase(self,R, G, B, wait): def color_chase(self,R, G, B, wait):