發表文章

目前顯示的是 4月, 2023的文章

PICO BIOS make Note2

圖片
 

PICO W Drive Lib by MicroPython note1

  =============== ##MCU Frequency check and Switch speed  import machine machine.freq()          # get the current frequency of the CPU machine.freq(240000000) # set the CPU frequency to 240 MHz The rp2 module: import rp2 =============== ##Delay and timing Use the time module: import time time.sleep(1)           # sleep for 1 second time.sleep_ms(500)      # sleep for 500 milliseconds time.sleep_us(10)       # sleep for 10 microseconds start = time.ticks_ms() # get millisecond counter delta = time.ticks_diff(time.ticks_ms(), start) # compute time difference =============== ##Pins and GPIO Use the machine.Pin class: from machine import Pin p0 = Pin(0, Pin.OUT)    # create output pin on GPIO0 p0.on()                 # set pin to "on" (high) level p0.off()                # set pin to "off" (low) level p0.value(1)             # set pin to on/high p2 = Pin(2, Pin.IN)     # create input pin on GPIO2 print(p2.value())       # get value, 0 or 1 p4 = Pin(4, Pin.IN, Pin.PULL_