def array(): imga = mic.get_map() b = mic.get_dir(imga) a = mic.set_led(b, (0, 0, 255)) imgb = imga.resize(80, 80) imgc = imgb.to_rainbow(1) return imgc
from Maix import MIC_ARRAY as mic import lcd lcd.init() mic.init() # reconfigure pins after mic.init() to match your wiring fpioa.set_function(32, fpioa.I2S0_IN_D0); fpioa.set_function(15, fpioa.I2S0_IN_D1); fpioa.set_function(23, fpioa.I2S0_IN_D2); fpioa.set_function(24, fpioa.I2S0_IN_D3); fpioa.set_function(21, fpioa.I2S0_WS); fpioa.set_function(22, fpioa.I2S0_SCLK); fpioa.set_function(13, fpioa.GPIOHS0 + 27); fpioa.set_function(14, fpioa.GPIOHS0 + 28); while True: imga = mic.get_map() b = mic.get_dir(imga) a = mic.set_led(b,(0,0,255)) imgb = imga.resize(240,160) imgc = imgb.to_rainbow(1) a = lcd.display(imgc) mic.deinit()
import sensor, image, lcd, time from Maix import MIC_ARRAY as mic from speech_recognizer import isolated_word #setup sample_rate = 16000 record_time = 4 #fm.register(20,fm.fpioa.I2S0_IN_D0, force=True) #fm.register(18,fm.fpioa.I2S0_SCLK, force=True) #fm.register(19,fm.fpioa.I2S0_WS, force=True) #rx = I2S(I2S.DEVICE_0) #rx.channel_config(rx.CHANNEL_0, rx.RECEIVER, align_mode=I2S.STANDARD_MODE) #rx.set_sample_rate(sample_rate) #sr = isolated_word(dmac=2, i2s=I2S.DEVICE_0, size=10, shift=1) #sr.set_threshold(0, 0, 10000) mic.init(i2s_d3=17, i2s_ws=16, i2s_sclk=15) sensor.reset(freq=15000000) sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.QVGA) sensor.set_windowing((224, 224)) sensor.run(1) lcd.init(type=1) lcd.rotation(2) sensor.set_hmirror(False) lcd.clear(lcd.WHITE) task = kpu.load("/sd/m.kmodel") labels = ["0", "1"] anchors = [ 0.875, 1.09375, 2.59375, 3.375, 4.03125, 5.40625, 3.3125, 4.34375, 1.6875, 2.125 ]