From 767fd193c38c2b66e7efa54dbe59c14f5b78e9de Mon Sep 17 00:00:00 2001 From: KillerBossOriginal Date: Tue, 3 Dec 2024 16:59:21 +0100 Subject: [PATCH] Aggiunto il supporto per il joycon --- Promano.ino | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/Promano.ino b/Promano.ino index f7dce4e..0461036 100644 --- a/Promano.ino +++ b/Promano.ino @@ -1,25 +1,33 @@ #include -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); }