Search found 51 matches

by RajaRamesh
Sun Jun 09, 2019 5:03 pm
Forum: ESP8266 boards
Topic: LCD 1602 - Library
Replies: 57
Views: 102585

Re: LCD 1602 - Library

from time import sleep_ms, ticks_ms from machine import I2C, Pin from esp8266_i2c_lcd import I2cLcd i2c = I2C(scl=Pin(5), sda=Pin(4), freq=400000) lcd = I2cLcd(i2c, 0x27, 2, 16) lcd.putstr("Hello ernitron\nIt's working!") lcd.clear() lcd.putstr("Using dhylands\npython_lcd") lcd = I2cLcd(i2c, 0x27, ...
by RajaRamesh
Sat Jun 08, 2019 2:52 pm
Forum: ESP8266 boards
Topic: Module for Ultrasonic sensor (HC-SR04)
Replies: 37
Views: 46737

Re: Module for Ultrasonic sensor (HC-SR04)

kevinkk525 wrote:
Sat Jun 08, 2019 2:27 pm
I guess self._pr isn't defined. you can replace it with 2
self._offs should be 0
Thank you Kevin for your help.
by RajaRamesh
Sat Jun 08, 2019 2:23 pm
Forum: ESP8266 boards
Topic: Module for Ultrasonic sensor (HC-SR04)
Replies: 37
Views: 46737

Re: Module for Ultrasonic sensor (HC-SR04)

Thank you Kevin. i will check and get back to you. Hi Kevin, Now i can see the distance in cm. But, first it is display's error in rounding value. why is it happening? try: dt = round(dt, self._pr) dt += self._off except Exception as e: print("error", "Error rounding value {!s}".format(dt)) return ...
by RajaRamesh
Fri Jun 07, 2019 6:04 am
Forum: ESP8266 boards
Topic: Module for Ultrasonic sensor (HC-SR04)
Replies: 37
Views: 46737

Re: Module for Ultrasonic sensor (HC-SR04)

async def _read(self) -> float: """ Returns distance in cm. Optionally compensated by temperature in °C. :return: float """ try: dt = round(dt, self._pr) dt += self._off except Exception as e: print("error", "Error rounding value {!s}".format(dt)) return dt return dt Thank you Kevin. i will check a...
by RajaRamesh
Wed Jun 05, 2019 4:23 pm
Forum: ESP8266 boards
Topic: Module for Ultrasonic sensor (HC-SR04)
Replies: 37
Views: 46737

Re: Module for Ultrasonic sensor (HC-SR04)

As the comment in the code says it outputs meters. You can use my library for comparison (you have to remove project specific imports and base class first though): https://github.com/kevinkk525/pysmartnode/blob/master/pysmartnode/components/sensors/hcsr04.py Thank you for sharing the details Kevin....
by RajaRamesh
Wed Jun 05, 2019 7:16 am
Forum: ESP8266 boards
Topic: Module for Ultrasonic sensor (HC-SR04)
Replies: 37
Views: 46737

Re: Module for Ultrasonic sensor (HC-SR04)

Hi, here is my module with calibration feature: https://github.com/Euter2/MicroPython/blob/master/ultrasonic.py Correct one. Connect distance sensor HC-SR04 to NodeMcu ESP8266 V3. Hi, After uploading ultrasonic.py on to ESP8266 .I used below code and output generate as shown below. was the output d...
by RajaRamesh
Wed Jun 05, 2019 7:07 am
Forum: ESP8266 boards
Topic: How to switch on a electric bulb with ESP8266 board?
Replies: 50
Views: 31101

Re: How to switch on a electric bulb with ESP8266 board?

Assuming you have the LED working as per the advice of @jimmo, you need something like The RTC on the ESP8266 is notoriously inaccurate. You might want to use similar logic to call settime() once at (say) 4:00. Thank you for sharing the details pythoncoder. i will try and get back to you if i face ...
by RajaRamesh
Tue May 28, 2019 11:57 am
Forum: ESP8266 boards
Topic: How to switch on a electric bulb with ESP8266 board?
Replies: 50
Views: 31101

Re: How to switch on a electric bulb with ESP8266 board?

t = time.localtime() t = t[0:3] + (0,) + (t[3] + TIMEZONE_OFFSET,) + t[4:6] + (0,) print("{}-{:02d}-{:02d} {:02d}:{:02d}:{:02d}".format(t[0], t[1], t[2], t[3],t[4],t[5]) Creates this output: 2019-05-20 14:56:03 (YYYY-MM-DD HH:mm:SS) Hi, i am trying to switch on LED every day for one hour and below ...
by RajaRamesh
Fri May 24, 2019 10:16 am
Forum: ESP8266 boards
Topic: How to switch on a electric bulb with ESP8266 board?
Replies: 50
Views: 31101

Re: How to switch on a electric bulb with ESP8266 board?

Frida wrote:
Thu May 23, 2019 5:33 pm
You have to put "a=pir.value()" inside the while loop.
It has to ask the pin in every loop
Thank you it's working as expected.
by RajaRamesh
Thu May 23, 2019 4:49 pm
Forum: ESP8266 boards
Topic: How to switch on a electric bulb with ESP8266 board?
Replies: 50
Views: 31101

Re: How to switch on a electric bulb with ESP8266 board?

Hi, i m trying with PIR sensor and below is the code in main.py, when i run the code on esp8266 board i am getting as below screens and each time i need to reset the button to detect the motion. can someone suggest me where i do wrong. main.py pin=Pin(2,Pin.OUT) pir=Pin(14,Pin.IN,Pin.PULL_UP) a=pir....