IR pneumatics
This commit is contained in:
parent
e9c4643e43
commit
5b7bacc64f
50
IR_pneumatics.ino
Normal file
50
IR_pneumatics.ino
Normal file
|
@ -0,0 +1,50 @@
|
|||
#include <IRremote.h>
|
||||
#include <Servo.h>
|
||||
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue