you could use:
const = lambda x:x
to avoid re-doing const statements. and you can query like:
if sys.implementation.name == "micropython":
......
to implement variants.
Search found 3667 matches
- Thu Oct 11, 2018 6:58 pm
- Forum: General Discussion and Questions
- Topic: Python and MicroPython compatibility
- Replies: 3
- Views: 2350
- Thu Oct 11, 2018 6:27 pm
- Forum: ESP8266 boards
- Topic: sending hex via UART
- Replies: 7
- Views: 11115
Re: sending hex via UART
Yes. The data is converted into a hex representation. I understood that this is what you need. So what is the data format the receiveing device expects? If you want to send the 4 bytes, you do not have to convert and you can send them directly. If you need just ASCII hex, you can use ubinascii.hexli...
- Thu Oct 11, 2018 4:19 pm
- Forum: ESP8266 boards
- Topic: sending hex via UART
- Replies: 7
- Views: 11115
- Thu Oct 11, 2018 1:29 pm
- Forum: ESP8266 boards
- Topic: sending hex via UART
- Replies: 7
- Views: 11115
Re: sending hex via UART
When data = [0xff, 0xff, 0xfd, 0x25],
b"".join(b'\\x%2x' % b for b in data)
will return the bytes array b'\\xff\\xff\\xfd\\x25'. The double backslash is just the escaped \. Actually, it is just one byte.
b"".join(b'\\x%2x' % b for b in data)
will return the bytes array b'\\xff\\xff\\xfd\\x25'. The double backslash is just the escaped \. Actually, it is just one byte.
- Tue Oct 09, 2018 6:11 pm
- Forum: ESP8266 boards
- Topic: accessing uart0 on nodemcu board
- Replies: 23
- Views: 16389
Re: accessing uart0 on nodemcu board
I made a short test code for uart0 read, and it works. The major difference is the second parameter on dupterm. from machine import UART import uos uos.dupterm(None, 1) uart = UART(0, 115200) uart.write(b"The quick brown fox jumps over the lazy dog\r\n") ch = b"" while ch != b"q": if uart.any(): ch ...
- Tue Oct 09, 2018 7:14 am
- Forum: ESP8266 boards
- Topic: accessing uart0 on nodemcu board
- Replies: 23
- Views: 16389
Re: accessing uart0 on nodemcu board
Which version of the firmware are you using?
Edit: You should also consider that uart.read() does not block. So if no data is available at the time of reading, it returns None.
Edit: You should also consider that uart.read() does not block. So if no data is available at the time of reading, it returns None.
- Mon Oct 08, 2018 7:48 pm
- Forum: ESP8266 boards
- Topic: accessing uart0 on nodemcu board
- Replies: 23
- Views: 16389
Re: accessing uart0 on nodemcu board
Even if REPL is not used when running code, uart0 ist not available as such, unless you call uos.dupterm(None) before instantiating it, to make it available as uart again. Without that, you can read the data on uart0 rx with sys.stdin.read(), and write to sys.stdout. But that read is blocking. Edit:...
- Mon Oct 08, 2018 6:27 pm
- Forum: ESP8266 boards
- Topic: improve speed
- Replies: 13
- Views: 7224
Re: improve speed
The discussion moves away form the initial topic, about how the total transfer rate can be improved. I do not understand that raw I2C communication speeds limits that, given that the actual data rate is 40 byte&/sec, and the raw I2C speed is 50kByte/sec. As said, in the main loop of the cited code t...
- Sun Oct 07, 2018 10:40 am
- Forum: ESP8266 boards
- Topic: DHT11/AM2301 does not work
- Replies: 6
- Views: 5630
Re: DHT11/AM2301 does not work
The AM2301 is equivalent to the DHT22.
So try:
d=dht.DHT22(machine.Pin(13))
That works for me.
So try:
d=dht.DHT22(machine.Pin(13))
That works for me.
- Sat Oct 06, 2018 6:27 pm
- Forum: ESP32 boards
- Topic: Documentation for ESP32 Port
- Replies: 13
- Views: 9122
Re: Documentation for ESP32 Port
I do not think that it's the best port. In my view, it is just another port. It contains things like ftp and telnet, which could as well be in the base version, like you find in in the CC3200 implementation or in the PyCom branch. Other stuff is overfeatured beyond a minimal base. But is is an impre...