Hello, starting with Arduino for the 5th time....
I'm trying to control an LED, to go from Pulsing, to Fully lit when a button is pressed (Motion detected actually)
These are super basic things, so I'm wondering if I'm using the wrong if/while/for thing....
All code snippets work as intended separately, they're JUST the examples for godssake!
void loop() {
int buttonState = digitalRead(sensorPin); //it isn't even checking or it would write the LED as SOMETHING
if (buttonState = LOW) {
for (int fadeValue = 0 ; fadeValue <= 255; fadeValue += 5) {
analogWrite(ledPin, fadeValue);delay(30);}
for (int fadeValue = 255 ; fadeValue >= 0; fadeValue -= 5) {
analogWrite(ledPin, fadeValue);delay(30);}
}
else { analogWrite(ledPin, 255); }
}