91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 0.38M
    文件類型: .pdf
    金幣: 1
    下載: 0 次
    發布日期: 2021-03-27
  • 語言: 其他
  • 標簽: 其他??

資源簡介


MicroPython for ESP32 快速參考手冊,包括常用的GPIO、PWM、ADC、DAC、NeoPixel等庫函數用法。
ESP32快速參考一 MicroPython1.92文檔 一旦網絡建立,你就可以用熟悉的 來創建和使用 延時和時間 詳見time import time time. sleep(1) sLeep for 1 second time. sleep_ms(500) sLeep for 500 milliseconds time. sleep_ us(10) t sLeep for 10 microseconds start time ticks_ ms(# get millisecond counter delta= time ticks diff(time ticks ms, start)# compute time difference 定時器 詳見 支持虛擬的基于 的定時器。 為 from machine in mport T tim=Timer(-1) tim init(period=5000, mode=Timer. ONE SHOT, callback=lambda t: print(1)) timinit(period=2000, mode=Timer. PERIODIC, callback=lambda t: print (2)) 的單位是毫秒, 為定時時間,每經過這段時問就會執行 凼數。 引腳和 詳見 from machine import Pin 4= Pin(4, Pin OUT) create output pin on GPI04 p4 value(0) set pin to high level p4 value(1) set pin to Low Level p5= Pin(5, Pin IN) f create input pin on GP102 print(p5 value() t get vaLue, 0 or 1 p4= Pin(4, Pin.IN, Pin. PULL UP ) enable internal puLl-up resistor p5= Pin(5, Pin OUT, value=1)# set pin high on creation 可供使用的引腳有 它們是芯片實際的引腳標號。注意很多開發板使用他們自己的特殊編號(比如 https://docs.singtown.com/micropython/zh/latest/esp32/esp32/quickref.html[2018/9/1214:34:571 ESP32快速參考一 MicroPython1.92文檔 因為 支持許多的板子和模組,使用物理的引腳編號是因為它們是最通用的編號。為了對 應你的板子的邏輯引腳和物理芯片上的引腳,參考你的板子的文檔。 注意 和 是 它們可能會影響后動 和 是 串口 引腳 一般連接到 只能被設置為輸入模式,并且軟件沒有上拉下 拉功能。 可以在所有的輸出引腳上使用。 有個通道,它們使用同一個頻率 (范圍 。占空比在 之間。 詳見 from machine import pin, PWM pwm4= PWM(Pin(4)) create PwM object from a pin t get current frequency pwm freq(1000) set frequenc pwm duty( get current duty cycle pwm duty(200) set duty cycle pwm4. deinito #f turn off PwM on the pin pwm5= PWM(Pin(5), freq=5000, duty=512)# create and configure in one go 注意 和 是 它們可能會影響功 和 是 串口 引朋 一般連接到 只能被設置為輸模式,并且軟件沒有上拉下 拉功能。 模數轉換 詳見 from machine import Pin, ADC adc= ADC(Pin(35)) create ADC object on ADC pin adc reado read value. 8-4095s 注意 在引腳 上可用。 般連接到一個電容,用于 引朏的輸入電壓在到之間。 https://docs.singtown.com/micropython/zh/latest/esp32/esp32/quickref.html[2018/9/1214:34:571 ESP32快速參考一 MicroPython1.92文檔 通用異步收發器串口 芯片上,有個 控制器。 詳見 注意: 已經被 使用。 軟件總線 有兩個驅動,一個是軟件實現的 ,可以用于任何引腳。 詳見 from machine import Pin, SPI construct an SPI bus on the given pins polarity is the idLe state of Sck phase=e means sampLe on the first edge of sck, phase=l means the second spi= SPI(-1, baudrate-100000, polarity=1, phase=0, sck=Pin(0), mosi=Pin(4), miso=Pin(5)) spiinit(baudrate=200000)# set the baudrate spi read(10) t read 10 bytes on MISO spi read(10, Oxff) t read 10 bytes while output ing oxff on MOSI buf bytearray (50) create a buffer spi.readinto(buf, Oxff)# read into the given buffer and output exff on Mos/ Case) spi. readinto (buf) read into the given buffer (reads 50 bytes in this case) spi. write(b 12345) write 5 bytes on MOSI buf= bytearray create a buffer spi. write readinto(b'1234', buf)# write to mosI and read from MIso into the buffer spi. write readinto(buf, buf)# write buf to MosI and read MISo back into buf 硬件 線 https://docs.singtown.com/micropython/zh/latest/esp32/esp32/quickref.html[2018/9/1214:34:571 ESP32快速參考一 MicroPython1.92文檔 硬件的更快高達 ,因為的 功能,你可以在任意的引腳綁定 最大的時鐘可以到達 如果你使用了 連接到其他的引腳最大 時鐘是 (半雙工) (全雙工)所以,大多數情況下(當你不需要大于 的速 度),你可以使用任意的引腳, 使用任意的輸入輸出引腳。 注意 因為沖突,你只能同時使用一個總線,但是一個總線可以連接很多設備,使用不同的引 腳卻。他和上面的軟件驅動有相同的方法,除了引腳參數和編號 from machine import pin, SPI hspi SPI(1, sck=Pin(14), mosi=Pin(13), miso=Pin (12), baudrate=80000000) vspi SPI(2, sck=Pin(18), mosi=Pin(23), miso=Pin(19), baudrate=80000000) for any pin with up 24MHZ hspi= SPI(l, sck=Pin(5), mosi=Pin(4), miso=Pin(6), baudrate=24000000) vspi SPI(2, sck=Pin(12), mosi=Pin(13), miso=Pin(14), baudrate=10000000) 驅動是軟件實現的,并且在所有的引腳上都可以使用。 詳見 from machine import Pin, I2C construct an I2c bus 12c I2C(scl=Pin(22), sda=Pin(21), freq=100000) print(i2c scan() i2c readfrom(0x3a, 4) read 4 bytes from slave device with address 0x3a i2cwriteto0x3a,12)#write 12 to slave device with address 0x3a buf bytearray (10) create a buffer with 10 bytes 12c. writeto(0x3a, buf) write the given buffer to the slave 實時時鐘 https://docs.singtown.com/micropython/zh/latest/esp32/esp32/quickref.html[2018/9/1214:34:571 ESP32快速參考一 MicroPython1.92文檔 注意 還沒有實現 詳見 from machine import rtc rtc datetime((2017,8, 23, 1,,, 0, 0))# set a specific date and time rtc datetime()# get date and time 注意 import machine configure RTC. ALARMo to be able to wake the device rtc= machine. RTCO rtcirq(trigger=rtc. ALARMO, wake=machine. DEEPSLEEP) #t check if the device woke from a deep sleep if machine reset cause()== machine. DEEPSLEEP RESET: print( woke from a deep sleep') f set RTC ALARMe to fire after 10 seconds (waking the device) rtc alarm(rtc. ALARMO, 10000) i put the device to sleep machine. deepsleepo) 驅動 驅動是軟件實現的,并且在所有的引腳上都可以使用 from machine import Pin import onewire oW= onewireOneWire(Pin(12))# create a Onewire bus on GPI012 ow. scan return a List of devices on the bus ow reset t reset the bus ow. readbyte read a byte ow, writebyte(0x12) write a byte on the bus ow. write("123’) write bytes on the bus owselect rom(b'12345678)# select a specific device by its ROM code 這是一個 和 的專門的驅動。 https://docs.singtown.com/micropython/zh/latest/esp32/esp32/quickref.html[2018/9/1214:34:571 ESP32快速參考一 MicroPython1.92文檔 請確定一個的上拉電阻連接在信號線。注意 convert temp()方法一定在你想測量溫度 的時候調用 驅動 詳見 neopixel from machine import pin from neopixel import NeoPixel pin Pin(4, Pin OUT) set GPIo4 to output to drive NeoPixeLs np= NeoPixel(pin, 8) create NeoPixel driver on GPI04 for 8 pixels [01=(255, 255, 255)# set the first pixel hit np. write t write data to all pixeL ,g,b=np[8] get first pixeL colour 還有一個底層的驅動 import esp esp. neopixel write(pin, grb buf, is800khz) 驅動 提供了個電容蝕摸引腳。它們分別是 當用戶觸摸表 面,電容的變化會蝕發,一個信號的值會返回 詳見 ouchPad from machine import Pin, TouchPad tc= TouchPad(Pin(4)) create TouchPad driver on GPIO4 tc reado when touch the pad, the value will Low around 80, if float the value is around 1000 注意 驅區動還沒有實現 詳見 apa102 https://docs.singtown.com/micropython/zh/latest/esp32/esp32/quickref.html[2018/9/1214:34:571 ESP32快速參考一 MicroPython1.92文檔 from machine import Pin from apa102 import APA102 clock Pin(14, Pin OUT) #f set GPT014 to output to drive the clock data= Pin(13, Pin OUT) set GPI013 to output to drive the data apa APA102(clock, data, 8)# create APA102 driver on the clock and the data pin for 8 pixels apa[o]=(255, 255, 255, 31)# set the first pixel to white with a maximum brightness of 31 apa. write #f write data to all pixels r, g, b, brightness apa[e] #f get first pixel colour import esp esp. apa102 write(clock pin, data pin, rgbi buf 驅區動 驅動是軟件實現的,并且工作在所有的引腳。 的 可通過網絡瀏覽器訪問是在 可用的實驗性質的功能。 下載網頁客戶端 主機版本可在以下地 址獲得: 并通過執行下列命合對其進行配置 并遵循屏幕上的指合。重后后,連接即可用。若您在后動時禁用自動后動,那么您可根據需要運行配 置的守護進程 您可通過連接 的熱點來使用 ,但守護進程也會在接口上后動(如果后動),所 以若您的路由器設置正確且工作正常,您可能也會在連接到正常網絡接入點時使用 (若您 遇到任何問題,請使用 連接方法)。 除終端命命提示訪間外, 也提供文件傳遞(包括上傳和下載)。網貝客戶端有對應函數的 https://docs.singtown.com/micropython/zh/latest/esp32/esp32/quickref.html[2018/9/1214:34:571 ESP32快速參考一 MicroPython1.92文檔 按鈕;您也可以從上述存儲庫中使用命合行客戶端 其他社區支持的傳輸文件到 的替代方案,請參見 論壇。 星瞳科技 最后更新于月 https://docs.singtown.com/micropython/zh/latest/esp32/esp32/quickref.html[2018/9/1214:34:571

資源截圖

代碼片段和文件信息

評論

共有 條評論