hello
i've been trying to run a motor which takes speed as input from the serial monitor, however it immediately reads a default value of 0 straight after
an image of the serial monitor after inputting 25
#include <AFMotor.h>
int speed = 0; //for the serial data coming in
AF_DCMotor frontLeft(1);
AF_DCMotor rearLeft(2);
AF_DCMotor rearRight(3);
AF_DCMotor frontRight(4);
void setup()
{
Serial.begin(9600);
frontLeft.run(RELEASE);
rearLeft.run(RELEASE);
rearRight.run(RELEASE);
frontRight.run(RELEASE);
}
void loop()
{
if (Serial.available() > 0);
speed = Serial.parseInt();
Serial.println(speed);
frontLeft.setSpeed(speed);
frontLeft.run(FORWARD);
rearLeft.setSpeed(speed);
rearLeft.run(FORWARD);
rearRight.setSpeed(speed);
rearRight.run(FORWARD);
frontRight.setSpeed(speed);
frontRight.run(FORWARD);
}