I thank you for helping all! I HAVE MADE SOLID PROGRESS.
#include <AFMotor.h>
AF_DCMotor motor1(1);AF_DCMotor motor2(2);
AF_DCMotor motor3(3);
int potpin1 = 8;
int potpin2 = 9;
int potpin3 = 10; // analog pin used to connect the potentiometerint val1;
int val2;
int val3; // variable to read the value from the analog pinvoid setup()
{
Serial.begin(9600);}
void loop()
{
val1 = analogRead(potpin1); // reads the value of the potentiometer (value between 0 and 1023)
val1 = map(val1, 0, 1023, 0, 255);
motor1.setSpeed(val1); // sets the motor speed according to the scaled valuemotor1.run(FORWARD);
delay(15);
val2 = analogRead(potpin2); // reads the value of the potentiometer (value between 0 and 1023)
val2 = map(val2, 0, 1023, 0, 255);
motor2.setSpeed(val2); // sets the motor speed according to the scaled valuemotor2.run(FORWARD);
delay(15);
val3 = analogRead(potpin3); // reads the value of the potentiometer (value between 0 and 1023)
val3 = map(val3, 0, 1023, 0, 255);
motor3.setSpeed(val3); // sets the motor speed according to the scaled valuemotor3.run(FORWARD);
delay(15);
}
It works. Now for random control with "snapshot" function...