From 5b7bacc64f788977fe7094af48d61c1c8e309607 Mon Sep 17 00:00:00 2001 From: ChristianSW Date: Sun, 24 Mar 2024 14:07:51 +0100 Subject: [PATCH] IR pneumatics --- IR_pneumatics.ino | 50 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 IR_pneumatics.ino diff --git a/IR_pneumatics.ino b/IR_pneumatics.ino new file mode 100644 index 0000000..a0f6b79 --- /dev/null +++ b/IR_pneumatics.ino @@ -0,0 +1,50 @@ +#include +#include + +// 1 = 69; +// 2 = 70; +// 3 = 71; +// 4 = 68; +// 5 = 64; +// 6 = 67; +// 7 = 7; +// 8 = 21; +// 9 = 9; +// 0 = 25; +// Asterisk = 22; +// Rhombus = 13; +// OK = 28; +// Up = 24; +// Down = 82; +// Left = 8; +// Right = 90; + +int IrWert = 0; +Servo pneu_servo; + +void setup() { + Serial.begin(9600); + IrReceiver.begin(11); + pneu_servo.attach(9); + pneu_servo.write(45); +} + +void loop() { + if (IrReceiver.decode()) { + IrReceiver.resume(); + IrWert = IrReceiver.decodedIRData.command; + Serial.print(IrWert); + if (IrWert == 24) { + pneu_servo.write(30); + delay(500); + } + if (IrWert == 28) { + pneu_servo.write(45); + delay(500); + } + if (IrWert == 82) { + pneu_servo.write(60); + delay(500); + } + } +}