amebaDocs
latest

開源開發平台:

  • Arduino 開發平台
  • Micropython 開發平台
    • 快速入門
    • 相關資源下載
    • Examples
      • Network/Peripheral Examples
        • [RTL8722CSM] [RTL8722DM] ADC - Read potentiometer
        • [RTL8722CSM] [RTL8722DM] GPIO - Blink
        • [RTL8722CSM] [RTL8722DM] I2C - Send and Receive
        • [RTL8722CSM] [RTL8722DM] PWM - LED fade
        • [RTL8722CSM] [RTL8722DM] RTC -Get time
        • [RTL8722CSM] [RTL8722DM] Socket - Echo Server and Client
        • [RTL8722CSM] [RTL8722DM] Socket - Get information from HTTP website
        • [RTL8722CSM] [RTL8722DM] SPI - Slave Receive
        • [RTL8722CSM] [RTL8722DM] Time - Delay and Timing
        • [RTL8722CSM] [RTL8722DM] Timer -Periodical timer
        • [RTL8722CSM] [RTL8722DM] UART - Send and Receive
        • [RTL8722CSM] [RTL8722DM] WiFi - WiFi Connect
        • [RTL8722CSM] [RTL8722DM] WiFi - WiFi Scan
        • Peripheral_SDFS_file_manipulation
    • Board HDK
    • API Documents
    • Resources
    • Support
  • Standard SDK
amebaDocs
  • »
  • Micropython 開發平台 »
  • Examples »
  • [RTL8722CSM] [RTL8722DM] GPIO - Blink
  • 在 GitHub 上修改

[RTL8722CSM] [RTL8722DM] GPIO - Blink

Materials

  • Ameba x 1, LED x 1, Resistor(220ohm) x 1

Steps

Blink is one of the best examples to get started with MicroPython.

Let us connect pin PB_22 to the anode leg of an LED which in series with a current limiting resistor and GND to cathode of the LED as shown below,

image1

Then, copy the following code and press Ctrl + e in REPL to enter the paste mode (for more information about REPL and paste mode, check “Getting started” page). If you are using Tera Term, simply right click on any blank space of the terminal and paste the code into REPL, then press Ctrl + d to execute the code. If everything is order, you should be able to see the LED blink for 3 times in 3 seconds.

 1from machine import Pin
 2a = Pin("PB_22", Pin.OUT)
 3a.value(1)
 4time.sleep_ms(500)
 5a.value(0)
 6time.sleep_ms(500)
 7a.on()
 8time.sleep_ms(500)
 9a.off()
10time.sleep_ms(500)
11a.toggle()
12time.sleep_ms(500)
13a.toggle()
上一页 下一页

© 版權所有 2021, Ameba IoT。 修订 cd3b58f3.

利用 Sphinx 构建,使用了 主题 由 Read the Docs开发.