From a266846e1817385e7d2df3fde419762b0fecb0c3 Mon Sep 17 00:00:00 2001 From: localhorst Date: Sun, 7 Oct 2018 21:11:36 +0200 Subject: [PATCH] =?UTF-8?q?Dateien=20hochladen=20nach=20=E2=80=9ESoftware/?= =?UTF-8?q?Rx6ChInput=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Software/Rx6ChInput/Rx6ChInput.ino | 80 ++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 Software/Rx6ChInput/Rx6ChInput.ino diff --git a/Software/Rx6ChInput/Rx6ChInput.ino b/Software/Rx6ChInput/Rx6ChInput.ino new file mode 100644 index 0000000..8e6bab3 --- /dev/null +++ b/Software/Rx6ChInput/Rx6ChInput.ino @@ -0,0 +1,80 @@ +#include +MicroPlaneSystem rx; + +MicroPlaneSystem servo1; +MicroPlaneSystem servo2; +MicroPlaneSystem servo3; +MicroPlaneSystem servo4; +MicroPlaneSystem servo5; + +int rud; +int ele; +int thro; +int ail; +int aux1; +int aux2; + +bool debugging = true; + +void setup() { + Serial.begin(115200); + Serial.println("Hello World"); + +/* + servo1.attach(7); + servo2.attach(8); + servo3.attach(9); + servo4.attach(10); + servo5.attach(11); + + */ +} + + +void loop() { + updateChannels(); + /* + + servo1.write(rud); + servo2.write(ele); + servo3.write(thro); + servo4.write(ail); + servo5.write(aux1); + */ + + //Do fancy stuff + +} + +void channelMapping() { + + rud = rx.getRxChannel(0); + ele = rx.getRxChannel(1); + thro = rx.getRxChannel(2); + ail = rx.getRxChannel(3); + aux1 = rx.getRxChannel(4); + aux2 = rx.getRxChannel(5); + +} + +void updateChannels() { + if (Serial.available()|| true) { + + if (rx.update()) { + channelMapping(); + if (debugging) { + for (int i = 0; i < 6; i++) { + Serial.print(" Ch0"); + Serial.print(i); + Serial.print(": "); + Serial.print(rx.getRxChannel(i)); + } + Serial.println(); + } + } + } else { + //No connection or Failsafe + + } +} +