Beschreibung
RC Tool um Klebekanten perfekt zu setzen. Damit hat Traction Roll ein schnelles Ende.
Braucht noch:
Arduino nano
Servo MG996R 360°
10k Potentiometer
USB C Charging Socket
USB C Cable 30cm, longer may work, may not
Verbindungen:
Left Pin Potentiometer to Arduino 5V
Middle Pin Potentiometer to A0 Arduino
Right Pin Potentiometer to Arduino Ground
Servo Signal to Pin 9 Arduino
Servo Ground to Ground Arduino
Servo Supply Voltage to VIn Arduino
USB Socket Ground to Ground Arduino
USB Socket Voltage to VIn Arduino
Use some hot glue to fix the arduino and the socket in the case
Arduino Code:
#include <Servo.h> // include Arduino Servo library
Servo servo; // create servo object to control a servo
#define PotPin A0 // define potentiometer output pin connection
#define ServoPin 9 // define Servo control pin connection
void setup()
{
servo.attach( ServoPin ); // attaches Servo control pin
}
void loop()
{
uint16_t an = analogRead(PotPin); // read analog data from potentiometer output
uint8_t angle = map(an, 0, 1023, 0, 90); // scale previous value between 0 and 180 (angle form)
if ( angle != servo.read() ) // check if angle changed
servo.write(angle); // set new servo motor angle
delay(10); // waits for the servo to get there
}
// end of code.
