hello everyone
i want to use the follow code:
import machine
# configure RTC.ALARM0 to be able to wake the device
rtc = machine.RTC()
rtc.irq(trigger=rtc.ALARM0, wake=machine.DEEPSLEEP)
it tell me 'AttributeError: 'RTC' object has no attribute 'irq''
dir(rtc). it tell me:
['__class__', 'datetime', 'init', 'memory']
so i want to know,how to resolve it?
1\. import another module for instead of RTC?
2\ RTC need some config?
i only want to use timer to enter deep-sleep mode and wake up it
thanks
by the way ,my english is poor,
我可以说中文,就会说的顺溜了 哈哈
about esp32 mcahine.RTC.irq
Re: about esp32 mcahine.RTC.irq
The ESP32 port doesn't have those attributes
https://github.com/micropython/micropyt ... rtc.c#L150
https://github.com/micropython/micropyt ... rtc.c#L150
Code: Select all
STATIC const mp_rom_map_elem_t machine_rtc_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&machine_rtc_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_datetime), MP_ROM_PTR(&machine_rtc_datetime_obj) },
{ MP_ROM_QSTR(MP_QSTR_memory), MP_ROM_PTR(&machine_rtc_memory_obj) },
};
STATIC MP_DEFINE_CONST_DICT(machine_rtc_locals_dict, machine_rtc_locals_dict_table);
const mp_obj_type_t machine_rtc_type = {
{ &mp_type_type },
.name = MP_QSTR_RTC,
.make_new = machine_rtc_make_new,
.locals_dict = (mp_obj_t)&machine_rtc_locals_dict,
};
- Mike Teachman
- Posts: 155
- Joined: Mon Jun 13, 2016 3:19 pm
- Location: Victoria, BC, Canada
Re: about esp32 mcahine.RTC.irq
If you want to deepsleep for a period of time you can try the following in MicroPython v1.9.4
>>> import machine
>>> machine.deepsleep(3000)
<ESP32 resets after 3 seconds>
you also might want to take a look at the LoBo port. It supports wake from deepsleep using a timer and using external pins
https://github.com/loboris/MicroPython_ESP32_psRAM_LoBo
>>> import machine
>>> machine.deepsleep(3000)
<ESP32 resets after 3 seconds>
you also might want to take a look at the LoBo port. It supports wake from deepsleep using a timer and using external pins
https://github.com/loboris/MicroPython_ESP32_psRAM_LoBo
Re: about esp32 mcahine.RTC.irq
thanks very much
it works well
i have a new question about deepsleep
it looks restart the programe
when programe start i set some initialize value and device: for example:
1. oled screen it will spangled per restart ,for it need initialize
i want to save some as global variables
when programe first start. it will be initialize
but when deepsleep ,it be saved when wake up from deepsleep. it can be use not must be initilaze again.
so the device like oled screen will not be spangled
it works well
i have a new question about deepsleep
it looks restart the programe
when programe start i set some initialize value and device: for example:
1. oled screen it will spangled per restart ,for it need initialize
i want to save some as global variables
when programe first start. it will be initialize
but when deepsleep ,it be saved when wake up from deepsleep. it can be use not must be initilaze again.
so the device like oled screen will not be spangled