MicroPython (一)点亮我的Led
生活随笔
收集整理的這篇文章主要介紹了
MicroPython (一)点亮我的Led
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
工具 :
- putty
- F429Discovery 開發板
- Notepad++
注意:不知道為什么 其他的終端工具有問題,推薦 putty 基本沒有發現問題
putty 實時調試
輸入help()如下所示
help() Welcome to MicroPython!For online help please visit http://micropython.org/help/.Quick overview of commands for the board: pyb.info() -- print some general information pyb.delay(n) -- wait for n milliseconds pyb.millis() -- get number of milliseconds since hard reset pyb.Switch() -- create a switch objectSwitch methods: (), callback(f) pyb.LED(n) -- create an LED object for LED n (n=1,2,3,4)LED methods: on(), off(), toggle(), intensity(<n>) pyb.Pin(pin) -- get a pin, eg pyb.Pin('X1') pyb.Pin(pin, m, [p]) -- get a pin and configure it for IO mode m, pull mode pPin methods: init(..), value([v]), high(), low() pyb.ExtInt(pin, m, p, callback) -- create an external interrupt object pyb.ADC(pin) -- make an analog object from a pinADC methods: read(), read_timed(buf, freq) pyb.DAC(port) -- make a DAC objectDAC methods: triangle(freq), write(n), write_timed(buf, freq) pyb.RTC() -- make an RTC object; methods: datetime([val]) pyb.rng() -- get a 30-bit hardware random number pyb.Servo(n) -- create Servo object for servo n (n=1,2,3,4)Servo methods: calibration(..), angle([x, [t]]), speed([x, [t]]) pyb.Accel() -- create an Accelerometer objectAccelerometer methods: x(), y(), z(), tilt(), filtered_xyz()Pins are numbered X1-X12, X17-X22, Y1-Y12, or by their MCU name Pin IO modes are: pyb.Pin.IN, pyb.Pin.OUT_PP, pyb.Pin.OUT_OD Pin pull modes are: pyb.Pin.PULL_NONE, pyb.Pin.PULL_UP, pyb.Pin.PULL_DOWN Additional serial bus objects: pyb.I2C(n), pyb.SPI(n), pyb.UART(n)Control commands: CTRL-A -- on a blank line, enter raw REPL mode CTRL-B -- on a blank line, enter normal REPL mode CTRL-C -- interrupt a running program CTRL-D -- on a blank line, do a soft reset of the board CTRL-E -- on a blank line, enter paste modeFor further help on a specific object, type help(obj) For a list of available modules, type help('modules')上面就是所有的Micro Python 幫助文檔。
輸入下面的指令打開一個Led。
MicroPython 脫機運行
脫機運行指離開電腦獨立運行,在插入USB的時候,電腦多了一個磁盤(不是Stlink V2.1),我們打開這個磁盤,里面有一個“main.py”文件。
打開這個文件,可以在里面輸入如下代碼
保存“main.py”文件,完成復位即可。
轉載于:https://www.cnblogs.com/memorypro/p/9510845.html
總結
以上是生活随笔為你收集整理的MicroPython (一)点亮我的Led的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: CF954I Yet Another S
- 下一篇: 基于MATLAB的Sobel边缘检测算法