Hello! I’m trying to control two DC motors with arduino uno via USB with Blynk virtual buttons.
The code I use for controlling motor without Blynk is:
int motorPin = 5;
void setup()
{
pinMode(motorPin, OUTPUT);
Serial.begin(9600);
while (! Serial);
Serial.println("Speed 0 to 255");
}
void loop()
{
if (Serial.available())
{
int speed = Serial.parseInt();
if (speed >= 0 && speed <= 255)
{
analogWrite(motorPin, speed);
}
}
}
Now, I tried and tried to make a code that will work with Blynk based on this code but without success. Any ideas?