工具 :

  • putty
  • F429Discovery 开发板
  • Notepad++

注意:不知道为什么 其他的终端工具有问题,推荐 putty 基本没有发现问题

putty 实时调试

  1. 使用putty 打开USB 虚拟串口,我们打开可以使用help()方法寻求帮助

输入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 object
Switch 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 p
Pin 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 pin
ADC methods: read(), read_timed(buf, freq)
pyb.DAC(port) -- make a DAC object
DAC 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 object
Accelerometer 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 mode For further help on a specific object, type help(obj)
For a list of available modules, type help('modules')

上面就是所有的Micro Python 帮助文档。

输入下面的指令打开一个Led。

>>> import pyb
>>> led = pyb.LED(1)
>>> led.on()
>>> led.off()
MicroPython 脱机运行

脱机运行指离开电脑独立运行,在插入USB的时候,电脑多了一个磁盘(不是Stlink V2.1),我们打开这个磁盘,里面有一个“main.py”文件。

打开这个文件,可以在里面输入如下代码

import pyb
while true:
pyb.LED(1).on()
pyb.delay(500)
pyb.LED(1).off()
pyb.delay(500)

保存“main.py”文件,完成复位即可。

最新文章

  1. (原创)JAVA多线程三锁
  2. 【cocos2d-js官方文档】一、搭建 Cocos2d-JS 开发环境
  3. js复制内容加版权声明代码
  4. / etc / init.d / iptables: line 268: restorecon: command not found
  5. iOS学习笔记---c语言第八天
  6. Tomcat工作原理
  7. 谈谈项目中遇到的各种iOS7适配问题
  8. GUI编程笔记(java)06:GUI窗体添加按钮并对按钮添加事件案例
  9. U-Boot在FL2440上移植(二)----支持NOR Flash
  10. js的dom操作和函数
  11. OpenResty安装使用教程(CentOS 6)
  12. day04-运算符
  13. vue项目中,localhost可以访问,IP无法访问的问题
  14. Codeforces Beta Round #27 E. Number With The Given Amount Of Divisors 含n个约数最小数
  15. lufylegend基础知识1
  16. DBMS_OUTPUT.PUT_LINE()方法的简单介绍
  17. nodejs 上传文件 upload
  18. 【转】ubuntu下修改文件夹权限
  19. 近期关于CI/CD策略以及git分支模型的思考
  20. PTA(BasicLevel)-1010 一元多项式求导

热门文章

  1. JS中如何获取当前时间及让时间格式化
  2. spring data jpa删除的使用方式
  3. 【307】◀▶ Python 相关功能实现
  4. bps、bit、byte的区别
  5. Linux实战教学笔记38:企业级Nginx Web服务优化实战(下)
  6. Blending
  7. JAVA中List的三个子类。
  8. Canny效果
  9. Python爬虫入门四之Urllib库的高级用法
  10. 【转】The most comprehensive Data Science learning plan for 2017