Through a combination of over-thinking and under-thinking, and some willful ignorance of suggestions made here, you seem to be regressing.
Using only part of what @alto777 was getting at in #26, here's a chopped up but complete and compiles version of your code. I had to comment out some things you left out of your last posted code. Always try to post a complete compiles and fuctions code, we like to take it and work with it in the IDE, so.
I also auto-formatted it, that's good for catching errors as C/C++ does not treat whitespace like you might want it to, the {s and }s rule, not indentation!
Below uou wll see one variable, 'theState' keeps all four sensor readings as bits 1, 2, 4 and 8. Their sum can be checked for combinations of bits. If you are worried that you might need state3, the corresponding bit can be tested
if (theState & 4) { /* test one bit in theState)
/* code to run if sensor3 is HIGH */
}
You can give nice names to the combinations like
define COMBO 9
which would be equal to theState if the 8 and 1 bits were set.
Then
if (theState == COMBO) // &c.
HTH
a7
//tail lamp dev v1
// alternate method
#include <Adafruit_NeoPixel.h>
#define PIN 3
const int sensorPin1 = A0; // select a input pin for control 1 RUN LAMP
const int sensorPin2 = A1; // select a input pin for control 2 TURN SIGNAL
const int sensorPin3 = A2; // select a input pin for control 3 BRAKE LIGHT
const int sensorPin4 = A3; // select a input pin for control 4 REVERSE
const int NUM_PIXELS = 256;
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_PIXELS, PIN, NEO_GRB);
void setup()
{
strip.begin();
strip.setBrightness(10);
strip.show(); // Initialize all pixels to 'off'
pinMode(A0, OUTPUT);
pinMode(A1, OUTPUT);
pinMode(A2, OUTPUT);
pinMode(A3, OUTPUT);
}
void loop()
{
int theState = 0; // all sensors LOW until proven HIGH!
if (digitalRead(sensorPin1) == HIGH) // read the value from the sensor1:
theState += 1;
delay(10);
if (digitalRead(sensorPin2) == HIGH) // read the value from the sensor2:
theState += 2;
delay(10);
if (digitalRead(sensorPin3) == HIGH) // read the value from the sensor3:
theState += 4;
delay(10);
if (digitalRead(sensorPin4) == HIGH) // read the value from the sensor4:
theState += 8;
delay(10);
if (theState == 13) // or whatever sum you wanna check
//RenderFrame (ledarrayoff),
delay(100);
}
void RenderFrame(const uint32_t *arr)
{
for (uint16_t t = 0; t < 256; t++)
{
strip.setPixelColor(t, arr[t]);
}
strip.show();
}