查看: 513|回复: 2
打印 上一主题 下一主题

MicroPython点亮LED

[复制链接] qrcode

35

主题

37

帖子

112

积分

注册会员

Rank: 2

积分
112
楼主
跳转到指定楼层
发表于 2016-5-26 02:21 PM | 只看该作者 回帖奖励 |倒序浏览 |阅读模式




在windows 下把MicroPython开发板通过USB 连接到电脑上。
windows会识别一个U盘。如下所示:



打开这个PYBFLASH的U盘,可以看到如下的文件:


boot.py – this script is executed when the pyboard boots up. It setsup various configuration options for the pyboard. 开发板上电的时候第一次执行的文件。类似于arduino的setup()
main.py – this is the main script that will contain your Python program.It is executed after boot.py.  在boot.py之后执行的程序,用户的代码可以写在这里面。
README.txt – this contains some very basic information about gettingstarted with the pyboard.
pybcdc.inf – this is a Windows driver file to configure the serial USBdevice. More about this in the next tutorial.


修改 main.py 文件如下:
  1. <font size="5"># main.py -- put your code here!
  2. from pyb import LED

  3. led = LED(1) # red led
  4. led.toggle()
  5. led.on()</font>
复制代码
上电,即可看到 红色led点亮。

编程变得如此的简单。。。


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复

使用道具 举报

0

主题

101

帖子

26

积分

新手上路

Rank: 1

积分
26
沙发
发表于 2016-5-26 02:41 PM | 只看该作者
点赞
回复 支持 反对

使用道具 举报

1

主题

101

帖子

19

积分

新手上路

Rank: 1

积分
19
板凳
发表于 2016-5-26 06:11 PM | 只看该作者
gtrjolin1986 发表于 2016-5-26 14:41
点赞

一起玩,,,,
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表