Hey guys.. I am working on a simple project, that is for some reason giving me fits. In the code, which I have either erased or commented out most anything of use in troubleshooting, You can see I am simply calling a function when I hit a switch.... however, it will not work. I put some serial debug stuff in there to try and see what was going on. The serial monitor does see the button go to the correct states but when it goes low the function does not run, nor the serial debug line within it. what stupid thing am I missing? Thanks in advance for the help. I have been a long time lurker.
int updimPin = 2;
int led = 10; // the pin that the LED is attached to
int brightness = 0; // how bright the LED is
int fadeAmount = 5; // how many points to fade the LED by
int upbuttonState;
int dwnbuttonState;
//unsigned long startMillis;
//unsigned long totalMillis;
void setup() {
pinMode(led, OUTPUT);
pinMode(updimPin,INPUT); //setup the switch pin
digitalWrite(updimPin,HIGH); //enable pull ups
analogWrite(led,5);
Serial.begin(4800);
}
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
void loop() {
upbuttonState = digitalRead(updimPin);
Serial.println(upbuttonState);
if (upbuttonState == LOW) {
//startMillis = millis();
void up();
delay(500);
}
}
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
void up() {
Serial.println("up pressed");
delay(200);
/* if (upbuttonState == HIGH) {
totalMillis = (millis() - startMillis);
if (brightness = 0 && totalMillis < 500) {
while (brightness < 255) {
brightness = brightness + fadeAmount;
analogWrite(led,brightness);}
}
}*/
}