Hello .
I created a code for a led strip , blinking , and i want to stop the blink whenever i press the button Stop , the s button on the code . Can you help me ? What i need to put inside the do-while for making the blinking stop.
Thanks.
#include <Nextion.h>
#include <NexButton.h>
NexButton s = NexButton(10 , 8 , "S");
NexButton br = NexButton(10 , 2 , "R");
NexTouch *nex_listen_list[] =
{
&s,
&br
};
void brPushCallback(void *ptr)
{
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
do
{
digitalWrite(5, HIGH);
digitalWrite(6, LOW);
digitalWrite(7, LOW);
delay(450);
digitalWrite(5, LOW);
delay(450);
} while(...);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
digitalWrite(7, LOW);
}
void sPushCallback(void *ptr)
{
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
digitalWrite(7, LOW);
}
void setup() {
// put your setup code here, to run once:
nexInit();
Serial.begin(9600);
s.attachPush(sPushCallback , &s);
br.attachPush(brPushCallback, &br);
}
void loop() {
// put your main code here, to run repeatedly:
nexLoop(nex_listen_list);
}