פיתוח אמבדד – שליחה וקבלה מידע ב IR
התקנת ספריה בארדואינו דרך 1
שלב 1 : Tools–>Manager Libraries
התקנה ספריה בארדואינו שלב 2:
נקליד IRRemote ניבחר את גירסת shimiff גירסה 3.8.1 עבור התוכנה הזאת .
נוריד את התוכנה ונקמפל
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
// www.robotronix.co.il // IR RECIVER #include <IRremote.h> #include <Servo.h> #define plus 0xFF18E7 #define minus 0xFF4AB5 int RECV_PIN = 3; Servo servo; int val; bool cwRotation, ccwRotation; IRrecv irrecv(RECV_PIN); decode_results results; void setup() { Serial.begin(9600); irrecv.enableIRIn(); } void loop() { if (irrecv.decode(&results)) { Serial.println(results.value, HEX); irrecv.resume(); // Receive the next value if (results.value == 0xFF18E7) { ccwRotation = false; Serial.println("Arrow up"); } if (results.value == 0xFF5AA5) { ccwRotation = false; Serial.println("Arrow right"); } if (results.value == 0xFF10EF) { ccwRotation = false; Serial.println("Arrow left"); } if (results.value == 0xFF4AB5) { ccwRotation = false; Serial.println("Arrow Down"); } } delay(20); } |