Search found 89 matches

by ernitron
Fri Jan 06, 2017 8:30 am
Forum: ESP8266 boards
Topic: LCD 1602 - Library
Replies: 57
Views: 103753

LCD 1602 - Library

I made some research but I have found little about LCD 1602 and micropython. I am looking for a simple library to pilot an LCD 1602 from WeMos D1 Mini (or other esp8266). Looking for simple API to send text on line 1 or 2, maybe adjust dim. Things like that. Are any problem to drive from the 5V outp...
by ernitron
Thu Jan 05, 2017 5:26 pm
Forum: ESP8266 boards
Topic: Reading from UART and KeyboardInterrupt
Replies: 6
Views: 8181

Re: Reading from UART and KeyboardInterrupt

I see. You have to consider that UART is asynchronous. So it can happen anytime and everywhere in your code causing exception. My routine is faulty as the ^C in your case happens during the time.sleep. I suggest: 1. Make the loop tight (i.e. substitute the time.sleep with pass) 2. try-catch all othe...
by ernitron
Wed Jan 04, 2017 8:55 pm
Forum: ESP8266 boards
Topic: AttributeError: type object 'socket' has no attribute 'timeout'
Replies: 3
Views: 9695

Re: AttributeError: type object 'socket' has no attribute 'timeout'

Am I doing something wrong? No I guess, not. I had the same problem. Looks like socket.timeout is not implemented (or is not the correct exception that upython throws on timeout). I simply catch everything and that worked for me. s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.settimeout(2.0...
by ernitron
Wed Jan 04, 2017 7:42 pm
Forum: ESP8266 boards
Topic: Reading from UART and KeyboardInterrupt
Replies: 6
Views: 8181

Re: Reading from UART and KeyboardInterrupt

Well, first of all thanks for giving a try to the patch for control-c. I think that should be included in the original firmware as it doesn't hurt ;) I think the problem is that the read will fail and exit before the 14th char can be read. Therefore I would try a loop like: chars = bytearray() while...
by ernitron
Mon Jan 02, 2017 9:59 pm
Forum: ESP8266 boards
Topic: TMP100 library - Please critique
Replies: 10
Views: 10045

Re: TMP100 library - Please critique

How about def read_temp(self): t = self.read_register(self.T_REG) return 0.00390625 * ustruct.unpack('>h', t)[0] @jimako the point being that ustruct performs the sign handling on a 16 bit quantity before it is reduced to 12 bits. Although the reduction to 12 bits is not explicit: it's subsumed int...
by ernitron
Wed Dec 28, 2016 11:15 pm
Forum: ESP8266 boards
Topic: Flashing micropython on Wemos D1 Mini Pro
Replies: 36
Views: 164789

Re: Flashing micropython on Wemos D1 Mini Pro

This is almost a FAQ ;) The symptoms are pretty clear: your chip goes into a rebooting loop (that's why it blinks continuously and you see a lot of garbage on uart whatever speed you set). The cause most probably, is because esptool.py flashed a WeMos D1 Mini Pro with 4m but it has 128mb (16MB) flas...
by ernitron
Wed Dec 28, 2016 7:31 am
Forum: ESP8266 boards
Topic: TMP100 library - Please critique
Replies: 10
Views: 10045

Re: TMP100 library - Please critique

Bonus. The corrected read_temp()

Code: Select all

def read_temp(self):
     t = self.read_register(self.T_REG)
     temp = ((t[0] << 8 | t[1]) >> 4)
     if temp & 0x800: # sign bit set
         temp = -((temp ^ 0xfff) + 1)
     return temp * 0.0625
by ernitron
Tue Dec 27, 2016 12:35 am
Forum: ESP8266 boards
Topic: TMP100 library - Please critique
Replies: 10
Views: 10045

Re: TMP100 library - Please critique

It looks like (but I can be wrong as I don't have a TMP100) you didn't consider the negative values. According to specs negative are represented as twos complement with msb set. Check the code for ds18b20. Test it putting your sensor in the refrigerator ;) Besides, I would have called read_temp() te...
by ernitron
Fri Dec 23, 2016 11:48 am
Forum: General Discussion and Questions
Topic: POST on HTTP Server
Replies: 7
Views: 8696

Re: POST on HTTP Server

from an HTTP server is possible get the body of a POST HTTP request? the example i found are only with GET. thanks Hi, I use something like: while True: try: self.conn, self.addr = self.socket.accept() req = self.conn.readline() except KeyboardInterrupt: raise OSError('Interrupt') except Exception ...
by ernitron
Fri Dec 16, 2016 11:45 am
Forum: ESP8266 boards
Topic: Making sounds
Replies: 12
Views: 22002

Re: Making sounds

Following this and other discussions that show that a higher frequency can be achieved in toggling pin, I was just wondering why there is the 1khz limit on PWM for ESP8266. It is only the current implementation or there are other issues?
Thanks