user code dualstate button demo
This commit is contained in:
parent
6ccbc32911
commit
3144214cfe
|
@ -1,19 +1,19 @@
|
||||||
#include <user_code.hpp>
|
#include <user_code.hpp>
|
||||||
|
|
||||||
|
|
||||||
ESPMega_Timer timer1(0, 50, timer1_callback, 15001);
|
ESPMega_Timer timer1(0, 50, timer1_callback, 15001);
|
||||||
|
|
||||||
// Display Componets
|
// Display Componets
|
||||||
|
// Link with Dual state button object with id 2 on page 1 named bt0
|
||||||
NexDSButton bt0 = NexDSButton(1, 2, "bt0");
|
NexDSButton bt0 = NexDSButton(1, 2, "bt0");
|
||||||
|
// List of Component ID Message to listen to
|
||||||
NexTouch *nex_listen_list[] =
|
NexTouch *nex_listen_list[] =
|
||||||
{
|
{
|
||||||
&bt0,
|
&bt0,
|
||||||
NULL
|
NULL};
|
||||||
};
|
|
||||||
|
|
||||||
void bt0PopCallback(void *ptr)
|
void bt0PopCallback(void *ptr)
|
||||||
{
|
{
|
||||||
Serial.println("BTN0!");
|
pwm_toggle(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -46,7 +46,6 @@ void user_loop()
|
||||||
nexLoop(nex_listen_list);
|
nexLoop(nex_listen_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This code will run when an input pin changed state
|
This code will run when an input pin changed state
|
||||||
*/
|
*/
|
||||||
|
@ -56,6 +55,11 @@ void virtual_interrupt_user_callback(int pin, int state)
|
||||||
|
|
||||||
void pwm_changed_user_callback(int pin)
|
void pwm_changed_user_callback(int pin)
|
||||||
{
|
{
|
||||||
|
if (pin == 2)
|
||||||
|
{
|
||||||
|
// inform the lcd when pwm 2 changed
|
||||||
|
bt0.setValue(pwm_get_state(2));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue