diff --git a/src/user_code.cpp b/src/user_code.cpp index 6272b03..74b10eb 100644 --- a/src/user_code.cpp +++ b/src/user_code.cpp @@ -1,19 +1,19 @@ #include - 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"); -NexTouch *nex_listen_list[] = -{ - &bt0, - NULL -}; +// List of Component ID Message to listen to +NexTouch *nex_listen_list[] = + { + &bt0, + NULL}; void bt0PopCallback(void *ptr) { - Serial.println("BTN0!"); + pwm_toggle(2); } /* @@ -46,7 +46,6 @@ void user_loop() nexLoop(nex_listen_list); } - /* 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) { + if (pin == 2) + { + // inform the lcd when pwm 2 changed + bt0.setValue(pwm_get_state(2)); + } } /*