/*==========================================================================
  //  Source-Code : BTS7960.ino
  //  Program: Steuerung fuer DC Motor mit BTS7960 H-Bridge Treiber.
  //==========================================================================
  //  Connection to the BTS7960 board:
  //  BTS7960 Pin 1 (RPWM) to Arduino pin 5(PWM)
  //  BTS7960 Pin 3 (R_EN), 4 (L_EN), 7 (VCC) bekommt vom Arduino 5V VCC
  //  BTS7960 Pin 8 (GND) to Arduino GND
  //  BTS7960 Pin 5 (R_IS) and 6 (L_IS) keine Verbindung
*/
int SENSOR_PIN = A0; // Pin fuers Poti
int RPWM_Output = 5; // PWM Ausgangs Pin 5
int PWM;
int sensorValue;
void setup()
{
  Serial.begin(115200);
  pinMode(RPWM_Output, OUTPUT);
}
void loop()
{
  sensorValue = analogRead(SENSOR_PIN);
  // Serial.println(sensorValue);

  PWM = map(sensorValue, 0, 1023, 1, 255);
  analogWrite(RPWM_Output, PWM);
}