Aggiunto il supporto per il joycon

This commit is contained in:
KillerBossOriginal 2024-12-03 16:59:21 +01:00
parent 5cb4ca8b7f
commit 767fd193c3

View file

@ -1,25 +1,33 @@
#include <Servo.h>
Servo myServo;
int const potPin = A0;
Servo servo1;
int const potPin1 = A0;
Servo servo2;
int const potPin2 = A1;
int potVal;
int angle;
void setup() {
myServo.attach(8);
servo1.attach(8);
servo2.attach(9);
Serial.begin(9600);
}
void loop() {
potVal = analogRead(potPin);
potVal = analogRead(potPin1);
angle = map(potVal, 0, 1023, 0, 179);
Serial.print("Potval: ");
servo1.write(angle);
Serial.print("Potval1: ");
Serial.print(potVal);
potVal = analogRead(potPin2);
angle = map(potVal, 0, 1023, 0, 179);
servo2.write(angle);
Serial.print("Potval2: ");
Serial.print(potVal);
Serial.print(" Angle: ");
Serial.print(angle);
myServo.write(angle);
delay(15);
}