#include "CytronMotorDriver.h"
#include "pins_arduino.h"
// Configure the motor drivers.
CytronMD motor1(PWM_DIR, 3, 4); // PWM 1 = Pin 3, DIR 1 = Pin 4.
const int potPin1 = A0; // Potentiometer 1 connected to analog pin A0
const int potPin2 = A1; // Potentiometer 2 connected to analog pin A1
void setup() {
pinMode(potPin1, INPUT); // Set potentiometer 1 pin as input
Serial.begin(9600);
}
void loop() {
// Read potentiometer values
int potValue1 = analogRead(potPin1);
Serial.print("Valeur du potentiomètre 1 : ");
Serial.println(potValue1);
// Map potentiometer values to motor speeds
int pwmValue1 = map(potValue1, 0, 1023, 0, 255);
Serial.print("Valeur de pwmValue1 : ");
Serial.println(pwmValue1);
motor1.setSpeed(pwmValue1);
delay(1000);
}