Nextion Relays

Can get some input please?
Am only trying to get the first relay to turn on, then i will write the remaining relays later. Just trying to get this first one work. The relay turns on by itself and does not turn off. The file compiles. Am using Mega 2560. Connected to TX2 RX2. I realize I need some work on my neopixel ring as well. With all the reading I have done, this is what i have come up with.

#include “Nextion.h”
#include <Adafruit_NeoPixel.h>

const int relay1Pin = 9;
const int relay2Pin = 8;
const int relay3Pin = 7;
const int relay4Pin = 6;
const int relay5Pin = 5;
const int relay6Pin = 4;
const int relay7Pin = 3;
const int relay8Pin = 2;
const int NEOPIXEL_PIN =26;

NexButton b0 = NexButton(0, 1, “b0”);
NexButton b1 = NexButton(0, 2, “b1”);
NexButton b2 = NexButton(0, 3, “b2”);
NexButton b3 = NexButton(0, 4, “b3”);
NexButton b4 = NexButton(0, 5, “b4”);
NexButton b5 = NexButton(0, 6, “b5”);
NexButton b6 = NexButton(0, 7, “b6”);
NexButton b7 = NexButton(0, 8, “b7”);
NexButton b8 = NexButton(0, 9, “b8”);

Adafruit_NeoPixel strip = Adafruit_NeoPixel(16, NEOPIXEL_PIN, NEO_GRB + NEO_KHZ800);

NexProgressBar j0 = NexProgressBar(0, 3, “j0”);

int NEOPIXEL_PINstate = LOW;
long previousMillis = 0;
long OnTime1 = 1500;

int relay1Pinstate = LOW;
long previousMillis1 = 0;
long OnTime2 = 1500;

int relay2Pinstate = LOW;
long previousMillis2 = 0;
long OnTime3 = 1500;

int relay3Pinstate = LOW;
long previousMillis3 = 0;
long OnTime4 = 1500;

int relay4Pinstate = LOW;
long previousMillis4 = 0;
long OnTime5 = 1500;

int relay5Pinstate = LOW;
long previousMillis5 = 0;
long OnTime6 = 1500;

int relay6Pinstate = LOW;
long previousMillis6 = 0;
long OnTime7 = 1500;

int relay7Pinstate = LOW;
long previousMillis7 = 0;
long OnTime8 = 1500;

int relay8Pinstate = LOW;
long previousMillis8 = 0;
long OnTime9 = 1500;

NexTouch *nex_listen_list =
{
&b0,
NULL
};
void setup()
{
Serial.begin(9600);
pinMode(NEOPIXEL_PIN, OUTPUT);
pinMode(relay1Pin, OUTPUT);
pinMode(relay2Pin, OUTPUT);
pinMode(relay3Pin, OUTPUT);
pinMode(relay4Pin, OUTPUT);
pinMode(relay5Pin, OUTPUT);
pinMode(relay6Pin, OUTPUT);
pinMode(relay7Pin, OUTPUT);
pinMode(relay8Pin, OUTPUT);
}
void loop()
{
unsigned long currentMillis = millis();
uint8_t b0 = digitalRead(b0);
if (b0 == HIGH)
{
b0 = 1;
if (b0 == 1)
{
if (currentMillis - previousMillis1 > 1500)
{
previousMillis1 = millis();
digitalWrite(relay1Pin, HIGH);
}
else
{
b0 = 0;
}
}
else {
digitalWrite(relay1Pin, LOW);
}
}
}

I have attached the updated version of this post. Can i get some assistance with what i am doing wrong?

Nextion just keeps telling me to stop asking the nursery why my crap is green. I really dont think that is very helpful in learning. I have attached my .ino file and the link to iTEAD Studio on the comment I received from them. :o

http://support.iteadstudio.com/support/discussions/topics/11000011762/page/last#post-11000052647

BOB.ino.txt (1.68 KB)