Hey,
this is my code and my motor does not respond on button click. the circuit is alright and i am not able to diagnose it help.
#include <AFMotor.h>
AF_DCMotor Rmotor(4, MOTOR12_1KHZ); // create motor #2, 64KHz pwm
AF_DCMotor Lmotor(3, MOTOR12_1KHZ);
void setup() {
pinMode(13, OUTPUT); // Use Built-In LED for Indication
pinMode(8, INPUT_PULLUP);
Serial.begin(9600);
// set up Serial library at 9600 bps
Serial.println("Motor test!");
Rmotor.setSpeed(225);
Lmotor.setSpeed(225);
}
void loop() {
bool buttonState = digitalRead(8);
if(buttonState){
Lmotor.run(FORWARD);
Rmotor.run(FORWARD);
}
digitalWrite(13,buttonState);
Serial.println(buttonState);
}