|
接上一篇帖子【一起玩esp8266】串口有输出,不能输入 - 【MicroPython开源版块】 - 电子工程世界-论坛 https://bbs.eeworld.com.cn/thread-497458-1-1.html
开始使用串口软件乱码,用putty后好一些,但是没法输入,一直交替输出 chg_A3:-180,chg_A3:0,D大说是网络信息,使用secureCRT同样无法输入,putty和secureCRT都不能输入,D大建议将Flow control改为None,参考一下这个帖子:
https://bbs.eeworld.com.cn/thread-497508-1-1.html
但是确实无流控制。
前两天见网友也说打开PuTTY,当复位后会死掉,无法输入,每次都是。给了一份解决方法,关掉PuTTY后,重新打开PuTTY就好了,或者用 SecureCRT,不会出现这个问题.
但是,但是我用putty和secureCRT都不能输入,今天按网友的说法再试一下,还是同样问题。无计可施时,忽然想到一个念头,我打开串口的同时连接PY板子怎么样。一试可以输入了,
串口只看到了第二部分信息,第一部分乱码信息错过了
- #4 ets_task(4010035c, 3, 3fff6350, 4)
- MicroPython v1.8.2 on 2016-07-21; ESP module with ESP8266
- LongRiver ver 1.0.2, by Mr. Shaoziyang & Liangjun, July 2016.
- Type "help()" for more information.
- MicroPython中文社区 http://www.micro-python.com
- >>> help()
- Welcome to MicroPython!
- For online docs please visit http://docs.micropython.org/en/latest/esp8266/ .
- For diagnostic information to include in bug reports execute 'import port_diag'.
- 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
- # Change name/password of ESP8266's AP:
- ap_if = network.WLAN(network.AP_IF)
- ap_if.config(essid="<AP_NAME>", authmode=network.AUTH_WPA_WPA2_PSK, password="<password>")
- 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)
- MicroPython中文社区 http://www.micro-python.com
复制代码 测试
- >>> print("123")
- 123
- >>> print("hello EEworld!")
- hello EEworld!
- >>> 2**4
- 16
- >>> import os
- >>> os.listdir()
- ['boot.py', 'main.py', 'demos', 'drive']
- >>> os.listdir('demos')
- ['led_test.py', 'morse.py', 'pwm_test.py', 'timer_test.py']
- >>> os.listdir('drive')
- ['bmp180.py', 'DHT11.py', 'morse.py', 'mpcomm.py']
- >>> open('\demos\led_test.py','r').readall()
- '"""\r\n \x0c\x10\u28faMicropython (ESP8266) LED\x00s\x0c\r\n \x17\x07\x15\U0001f8fashaoziyang\r\n \uac7c\u48fa2016.7\r\n"""\r\n\r\nimport machine, time\r\nfrom machine import Pin\r\n\r\n# \x12\x05LED\r\nled = Pin(2, Pin.OUT)\r\n\r\n# LED\x02\n\x14\r\ndef led_test():\r\n for i in range(10):\r\n led(0)\r\n time.sleep_ms(100)\r\n led(1)\r\n time.sleep_ms(100)\r\n\r\n\r\n'
复制代码 drive和demos各有四个例程,打开led_test看一下,程序是控制LED闪烁,0.2s一次
LED测试,低电平点亮esp8266的蓝色LED,
看了一下电路图竟然没有LED,估计这个LED应该是esp8266的GP0控制,应该是这么个电路
输了一个linux指令报错
- >>> import os
- >>> from machine import Pin
- >>> p0=Pin(0,Pin.OUT)
- >>> p0.high()
- >>> p0.low()
- >>> p0.value(1)
- >>> df
复制代码 1、0和high、low作用相同,因为板子就一个LED,所以p2的变化看不到
- >>> c=Pin(2,Pin.OUT)
- >>> c(1)
- >>> c(0)
- >>> c.high()
复制代码 然后试着设置一下网络,设置esp8266成station模式,其他无线SSID都扫描出来了,唯独我的601没有扫描到,-80应该是信号强度
- >>> import network
- >>> wlan=network.WLAN(network.STA_IF)
- >>> wlan.active(True)
- mode : sta(5c:cf:7f:c2:72:87) + softAP(5e:cf:7f:c2:72:87)
- #5 ets_task(4020e1f0, 28, 3fff7f80, 10)
- add if0
- >>> wlan.scan()
- f r0, scandone
- [(b'FAST_ADCA', b'x\xeb\x14\xf3\xad\xca', 2, -80, 4, 0), (b'1990', b'8Y\xf9\x8ex06\xd4', 11, -85, 3, 0), (b'88888888888899', b'\xd0\xc7\xc0\nY\xba', 11, -81, , 0)]
- >>> wlan.isconnected()
- False
- >>> wlan.connect('601','XXXXXXXX')
- f r0, >>> scandone
- state: 0 -> 2 (b0)
- state: 2 -> 3 (0)
- state: 3 -> 5 (10)
- add 0
- aid 25
- cnt
复制代码 D大,add 0,add 25是什么意思?ets_task(4010035c, 3, 3fff6350, 4)是什么意思?不是MAC地址吧?和上面的不一样啊
继续输出,找到了掩码、网关,然后一大堆错误
- connected with 601, channel 1
- dhcp client start...
- ip:192.168.1.127,mask:255.255.255.0,gw:192.168.1.1
- #4 ets_task(4010035c, 3, 3fff6350, 4)
- >>> MicroPython v1.8.2 on 2016-07-21; ESP module with ESP8266
- Traceback (most recent call last):
- File "<stdin>", line 1
- SyntaxError: invalid syntax
- >>> LongRiver ver 1.0.2, by Mr. Shaoziyang & Liangjun, July 2016.
- Traceback (most recent call last):
- File "<stdin>", line 1
- SyntaxError: invalid syntax
- >>> Type "help()" for more information.
- Traceback (most recent call last):
- File "<stdin>", line 1
- SyntaxError: invalid syntax
- >>> MicroPython http://www.micro-python.com
- Traceback (most recent call last):
- File "<stdin>", line 1
- SyntaxError: invalid syntax
- >>> >>> help()
- Traceback (most recent call last):
- File "<stdin>", line 1
- SyntaxError: invalid syntax
- >>> Welcome to MicroPython!
- Traceback (most recent call last):
- File "<stdin>", line 1
- SyntaxError: invalid syntax
- >>>
- >>> For online docs please visit http://docs.micropython.org/en/latest/esp8266/.
- Traceback (most recent call last):
- File "<stdin>", line 1
- SyntaxError: invalid syntax
- >>> For diagnostic information to include in bug reports execute 'import port_dag'.
- Traceback (most recent call last):
- File "<stdin>", line 1
- SyntaxError: invalid syntax
- >>>
- >>> Basic WiFi configuration:
- Traceback (most recent call last):
- File "<stdin>", line 1
- SyntaxError: invalid syntax
- >>>
- >>> import network
- >>> sta_if = network.WLAN(network.STA_IF); sta_if.active(True)
- >>> sta_if.scan() # Scan for available access point
- scandone
- [(b'FAST_ADCA', b'x\xeb\x14\xf3\xad\xca', 2, -81, 4, 0), (b'FAST_CB5B9A', b'(,\b2\xcb[\x9a', 11, -86, 4, 0), (b'88888888888899', b'\xd0\xc7\xc0\nY\xba', 11, -9, 4, 0)]
- >>> sta_if.connect("<AP_name>", "<password>") # Connect to an AP
- f r0, >>> sta_if.isconnected() # Check for successful connction
- ap_loss
- scandone
- state: 5 -> 0 (0)
- rm 0
- reconnect
- f 0, False
- >>> # Change name/password of ESP8266's AP:
- >>> ap_if = network.WLAN(network.AP_IF)
- >>> ap_if.config(essid="<AP_NAME>", authmode=nscandone
- no <AP_name> found, reconnect after 1s
- reconnect
- f -180, scandone
- no <AP_name> found, reconnect after 1s
- reconnect
- f r0, scandone
- no <AP_name> found, reconnect after 1s
- reconnect
复制代码 然后我软件复位
- ESP: soft reboot
- Traceback (most recent call last):
- File "boot.py", line 4, in <module>
- File "webrepl.py", line 64, in start
- File "webrepl.py", line 21, in setup_conn
- OSError: [Errno 12] ENOMEM
- Welcome to using LongRiver MicroPython ver 1.02!
- http://www.micro-python.com
- Traceback (most recent call last):
- File "main.py", line 4, in <module>
- ImportError: no module named 'morse'
复制代码 一直循环输出如下信息,硬件复位后还是继续输出
- reconnect
- f 0, scandone
- no <AP_name> found, reconnect after 1s
- reconnect
- f -180, scandone
- no <AP_name> found, reconnect after 1s
- reconnect
- f r0, scandone
- no <AP_name> found, reconnect after 1s
- reconnect
- f 0,
复制代码 只能断电了
|
赞赏
-
1
查看全部赞赏
-
|