I don't know much about coding for arduino and copy pasted this code for controlling a dc motor with a transistor, i keep getting an error message saying "pushButton not declared in this scope" and cant seem to find an answer that works in google searches. Any guidance would be appreciated
void setup() {
pinMode(pushButton, INPUT);
pinMode(motorControl, OUTPUT);
}
void loop() {
// read the state of the button and check if it is pressed
if(digitalRead(pushButton) == HIGH){
// ramp up the motor speed
for(int x = 0; x <= 255; x++){
analogWrite(motorControl, x);
delay(50);
}
// ramp down the motor speed
for(int x = 255; x >= 0; x--){
analogWrite(motorControl, x);
delay(50);
}
}
delay(1); // delay in between reads for stability
}
After taking 25.6 seconds to ramp the motor up to full speed, and back down, do you REALLY think that an additional 0.001 seconds is going to make ANY difference?