esp32-micropython
本来之前买和另一贴子的esp8266一起买了一块esp32.
现在开发esp的大概有乐鑫的ide以及基于乐鑫定制的、arduino、nodemcu、还有就是现在要讲的micropython.
乐鑫的主要跑ucos,arduino版本顾名思义,nodemcu用lua脚本语言,micropython用定制的python。
每一种都或多或少接触过,偶然的时候在NDIY论坛看到F4跑micropython,用python语言干单片机的活,然后就百度了下。
感觉如果拿来做轻量开发十分方便,比arduino还方便。恰好身边也有人在学python,学好了还可以介绍给他们。
http://www.eeboard.com/evaluation/pyboard/
这个帖子写的是pyboard评测,从中可以看出micropython的特点。
官方自己下的定义:
MicroPython - a lean and efficient Python implementation for microcontrollers and constrained systems
https://micropython.org
以下是安装步骤:
先安装esptool.py
pip install esptool.py
没装pip先sudo apt装好pip
然后不知道为什么我默认安装到/home/xxx/.local/bin/这个目录里面了,百度过来都是直接pip好了就能用,然后我locate esptool找到了脚本的位置,
然后在.bashrc里面alias esptool="/home/xxx/.local/bin/esptool.py"然后source一下就行了.
先按照官网说的:
Firmware for ESP32 boards
The following files are daily firmware for ESP32-based boards, with separate firmware for boards with and without external SPIRAM. Non-SPIRAM firmware will work on any board, whereas SPIRAM enabled firmware will only work on boards with 4MiB of external pSRAM. Program your board using the esptool.py program, and put the firmware starting at address 0x1000. For example: esptool.py --chip esp32 --port /dev/ttyUSB1 write_flash -z 0x1000 esp32-20180511-v1.9.4.bin. If you are putting MicroPython on for the first time then you should first erase the entire flash using esptool.py --chip esp32 erase_flash.
清除flash
katachi@katachi-Inspiron-:~/eclipse-workspace/micropython$ esptool --chip esp32 --port /dev/ttyUSB0 erase_flash
esptool.py v2.5.0
Serial port /dev/ttyUSB0
Connecting........__
Chip is ESP32D0WDQ6 (revision )
Features: WiFi, BT, Dual Core
MAC: :ae:a4:3a:1b:9c
Uploading stub...
Running stub...
Stub running...
Erasing flash (this may take a while)...
Chip erase completed successfully in .6s
Hard resetting via RTS pin...
katachi@katachi-Inspiron-:~/eclipse-workspace/micropython$
然后刷进去:
katachi@katachi-Inspiron-:~/eclipse-workspace/micropython$ esptool --chip esp32 --port /dev/ttyUSB0 write_flash -z 0x1000 esp32spiram--v1.9.4--g5cd2c7f2e.bin
esptool.py v2.5.0
Serial port /dev/ttyUSB0
Connecting....
Chip is ESP32D0WDQ6 (revision )
Features: WiFi, BT, Dual Core
MAC: :ae:a4:3a:1b:9c
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed bytes to ...
Wrote bytes ( compressed) at 0x00001000 in 60.7 seconds (effective 147.1 kbit/s)...
Hash of data verified. Leaving...
Hard resetting via RTS pin...
刷的是带ram的,但是rst后报错,然后刷了不带ram的就启动了,用串口连接,是一个叫REPL(read evaluate print loop)的交互bash,
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
flash read err,
ets_main.c
ets Jun :: rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: , SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:
load:0x3fff0018,len:
load:0x3fff001c,len:
load:0x40078000,len:
load:0x40080400,len:
entry 0x4008114c
I () cpu_start: Pro cpu up.
I () cpu_start: Single core mode
I () heap_init: Initializing. RAM available for dynamic allocation:
I () heap_init: At 3FFAE6E0 len ( KiB): DRAM
I () heap_init: At 3FFC4F48 len 0001B0B8 ( KiB): DRAM
I () heap_init: At 3FFE0440 len 00003BC0 ( KiB): D/IRAM
I () heap_init: At 3FFE4350 len 0001BCB0 ( KiB): D/IRAM
I () heap_init: At len 0000EBB8 ( KiB): IRAM
I () cpu_start: Pro cpu start user code
I () cpu_start: Starting scheduler on PRO CPU.
OSError: [Errno ] ENOENT
MicroPython v1.9.4--g5cd2c7f2e on --; ESP32 module with ESP32
Type "help()" for more information.
>>>
help一下
Welcome to MicroPython on the ESP32! For generic online docs please visit http://docs.micropython.org/ For access to the hardware use the 'machine' module: import machine
pin12 = machine.Pin(, machine.Pin.OUT)
pin12.value()
pin13 = machine.Pin(, machine.Pin.IN, machine.Pin.PULL_UP)
print(pin13.value())
i2c = machine.I2C(scl=machine.Pin(), sda=machine.Pin())
i2c.scan()
i2c.writeto(addr, b'')
i2c.readfrom(addr, ) Basic WiFi configuration: import network
sta_if = network.WLAN(network.STA_IF); sta_if.active(True)
sta_if.scan() # Scan for available access points
sta_if.connect("<AP_name>", "<password>") # Connect to an AP
sta_if.isconnected() # Check for successful connection 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')
esp32-micropython的更多相关文章
- 登录华科校园网,我用Socket
登录华科校园网,我用Socket 导语: 找一个华科学生问一问,学校的网络怎么样?得到的大多数是负面回答.其实不论是从覆盖区域.网络稳定性.还是速度来说,华科做的都还是可以的(24:00断网除外).可 ...
- 如何为 esp32 编译和配置及烧写 MicroPython 固件。
MicroPython 在 esp-idf (esp32) 上编译固件 esp32 编译 micropython 的固件相关的资料应该很多吧,我也会出一篇,但会额外讲一些 linux 的东西的. 资料 ...
- ESP32与MicroPython入门-01 搭建开发环境
ESP32简介 ESP32 是上海乐鑫公司开发的一款比较新的32位微控制器,它集成了WiFi及蓝牙等功能,有着性能稳定.功耗低.价格低廉等特点,非常适用于物联网开发,但也可以作为普通的MCU使用. E ...
- esp32驱动SSD1306的oled显示汉字(micropython)
1.完整源码: 主函数oled.py from ssd1306 import SSD1306_SPI from ssd1306 import SSD1306 import font import ma ...
- (2)用Micropython将ESP32数据上云
之前我们尝试过直接把LED点亮并且闪烁. 今天尝试一下将LED的开关状态上云,并可以通过云来进行数据下发. 数据要上云,首先开发板要联网. 首先我们会用 Python的network 库, 在netw ...
- MicroPython的开发板
比如: pyboard micro:bit ESP8266/ESP32 stm32等等 什么是pyboard? pyboard是官方的MicroPython微控制器板,完全支持软件功能.硬件有: ST ...
- micropython驱动sh1106点亮oled
继上一帖给esp32刷入micropython之后,忍不住给以esp12e也刷了micropython 这里先说一下webrepl: 通过wifi可以和esp8266交互,以及便携的传输文件 首次使用 ...
- microPython环境安装及使用
1.ESP8266_12E(NodeMCU1.0)(AI Thinker)板Arduino IDE环境安装 (1)方法1(自动安装,windows,mac,linux平台都可) http://ardu ...
- 说说 MicroPython 的项目整体架构
今天来说说 MicroPython 的架构情况,如果有必要我会做一些源码分析的文章供大家参考. 先来认识一下 MicroPython 整体情况,可以从软件的角度上去看待,首先我们拿到 MicroPyt ...
- Esp32的一些资料链接
http://wiki.ai-thinker.com/doku.php/utils/esp32_idf_menuconfig http://wiki.ai-thinker.com/doku.php ...
随机推荐
- No Ads for Blogs
最近浏览器出问题了还是博客园登录的问题. 每次进入自己博客都要输入密码. 然后进入某一篇博文查看时,底部总会有些垃圾广告. 怎么办呢. 好吧,真抱歉,为了营造良好的阅读环境,只好给你屏蔽掉了. 其实也 ...
- 关于vb编程之字符串连接/拼接的方法与技巧
在VB中,笔者知道的字符串的拼接方法主要有两种拼接符号,一种为"&"符,另一种则为"+"符 一.其中&连接运算符用于强制将两个表达式作为字符串连 ...
- ZooKeeper-3.3.4集群安装配置
https://blog.csdn.net/shirdrn/article/details/7183503
- 性能优化-YAHOO军规
1.尽可能减少http请求数量 2.使用CDN 3.添加Expire/Cache-Control头 4.启用Gzip压缩 5.将css放在页面最上 6.将script放在页面最下 7.避免在CSS中使 ...
- Django中URL有关
django 模板中url的处理 在模板中直接添加‘/home’这样的链接是十分不推荐的,因为这是一个相对的链接,在不同网页中打开可能会返回不一样的结果. 所以推荐的是 1 <a href= ...
- vue的属性样式绑定,
<template> <div id="app"> <div v-html="H"></div> //绑定ht ...
- Codeforces 1090B - LaTeX Expert - [字符串模拟][2018-2019 Russia Open High School Programming Contest Problem B]
题目链接:https://codeforces.com/contest/1090/problem/B Examplesstandard input The most famous characters ...
- 使用docker容器运行MySQL数据库并持久化数据文件
1.下载mysql镜像 # docker pull mysql 2.启动mysql容器 # docker run -itd -v /data:/var/lib/mysql -p 33060:3306 ...
- H5的缓存 manifest
H5里面的App Cache是由开发Web页面的开发者控制的,而不是由Native去控制的,但是Native里面的WebView也需要我们做一下设置才能支持H5的这个特性. 1.工作原理 写Web页面 ...
- stm32专属于菜鸟的学习方法
1.首先我们先看看与STM32相关的文档 我们假定大家已经对STM32的书籍或者文档有一定的理解.如不理解,请立即阅读STM32的文档,以获取最基本的知识点. 如果你手上拥有ST官方主推的STM32神 ...