How to switch on a electric bulb with ESP8266 board?

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Online
ThomasChr
Posts: 107
Joined: Sat Nov 25, 2017 7:50 am

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

Post by ThomasChr » Mon May 13, 2019 9:41 am

@RajaRamesh:
You simply switch on or off the Pin which is connected to the Relay. There is no magic involved here!

RajaRamesh
Posts: 9
Joined: Wed May 08, 2019 10:54 am

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

Post by RajaRamesh » Mon May 13, 2019 5:20 pm

Thank you Thomas...i will try and get back to you.

RajaRamesh
Posts: 9
Joined: Wed May 08, 2019 10:54 am

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

Post by RajaRamesh » Fri May 17, 2019 3:50 pm

Hi,

is it possible to schedule the code to run particular day,time on esp8266 board ?

Thanks

User avatar
jimmo
Posts: 84
Joined: Tue Aug 08, 2017 1:57 am

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

Post by jimmo » Sat May 18, 2019 12:23 am

Have a look at https://docs.micropython.org/en/latest/ ... e.RTC.html

Note you'll need a way to set the current time -- there's an ntptime module available as a frozen module: https://github.com/micropython/micropyt ... ntptime.py

RajaRamesh
Posts: 9
Joined: Wed May 08, 2019 10:54 am

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

Post by RajaRamesh » Mon May 20, 2019 4:04 pm

jimmo wrote:
Sat May 18, 2019 12:23 am
Have a look at https://docs.micropython.org/en/latest/ ... e.RTC.html

Note you'll need a way to set the current time -- there's an ntptime module available as a frozen module: https://github.com/micropython/micropyt ... ntptime.py
Hi ,

i gone through the links and understand machine.RTC one and build as below.
rtc=machine.RTC()
rtc.datetime((2019,5,20,9,0,0,0,0))
rtc.datetime() # displays current time but it is showing different time stamp.how can i get IST standard?

Now i am trying to display year alone and month...etc and receiving error as below. how can i get year/ month/day/hour/....?

>>> print(rtc.datetime('year'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: object 'str' is not a tuple or list

kevinkk525
Posts: 380
Joined: Sat Feb 03, 2018 7:02 pm

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

Post by kevinkk525 » Mon May 20, 2019 4:51 pm

Code: Select all

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)

Post Reply