Professional Documents
Culture Documents
h>
//#include "Adafruit_NeoPixel.h"
#include "Nextion.h"
#define PIN 6
#define led 13
#define numpixels 15
//int delayval=100;
NexButton b0 = NexButton(0,1,"b0");
NexButton b1 = NexButton(0,2,"b1");
NexText t0 = NexText(0,3,"t0");
NexSlider h0=NexSlider(0,4,"h0");
int32_t val;
int ab=0;
NexTouch *nex_listen_list[] = {
&b0,
&b1,
NULL
};
t0.setText ("State:ON");
ab=1;
t0.setText ("State:OFF");
ab=0;
t0.setText ("State:ab");
h0.getValue(&val);
}
void setup() {
Serial.begin(9600);
nexInit();
pinMode(led,OUTPUT);
b0.attachPop(b0PopCallback,&b0);
b1.attachPop(b1PopCallback,&b1);
h0.attachPop(b0PopCallback,&h0);
adaled.begin();
long colour()
h0.getValue(&val);
{
return adaled.Color(255 - val, val, 0);
else
// For a set of NeoPixels the first NeoPixel is 0, second is 1, all the way up to the count of pixels minus
one.
void led1(){
nexLoop(nex_listen_list);
for(int i=0;i<numpixels;i++)
if(ab==1){
digitalWrite(led,HIGH);
else if(ab==0)
{ digitalWrite(led,LOW);
adaled.setPixelColor(i, adaled.Color(0,0,0));
else
{ digitalWrite(led,LOW);
adaled.setPixelColor(i, adaled.Color(0,0,0));}
}}
void loop() {
/// h0.getValue(&val);
led1();
adaled.show();