Petoi Doc Center
🇹🇭 Thai
🇹🇭 Thai
  • ยินดีต้อนรับสู่ Petoi Doc Center
  • Infrared Remote
    • รีโมทคอนโทรล
  • Mobile App
    • คาลิเบเตอร์และคอนโทรลเลอร์
  • Desktop APP
    • การแนะนำเบื้องต้น
    • ตัวอัปโหลดเฟิร์มแวร์
    • การคาลิเบรทข้อต่อ
    • สกิลคอมโพสเซอร์
  • Arduino IDE
    • อัปโหลด Sketch สำหรับ NyBoard
    • อัปโหลด Sketch สำหรับ BiBoard
    • การคาลิเบรทด้วย Arduino IDE
    • ซีเรียลมอนิเตอร์
  • API
    • 🖇️ซีเรียลโปรโตคอล
    • 🐍คู่มือผู้ใช้ Python SerialMaster
    • 🐛MicroPython คอนโทรลเลอร์
      • การเรียกใช้ MicroPython บน ESP8266
      • ติดตั้ง WebREPL
      • การใช้โปรโตคอล ESP-NOW
    • 🍓การสื่อสารผ่านพอร์ตซีเรียลของ Raspberry Pi
    • 🤖ROS
  • Nyboard
    • NyBoard V1_0
    • NyBoard V1_1
  • BIBOARD
    • คู่มือเริ่มต้นใช้งาน BiBoard ฉบับรวบลัด
    • Demo Applications
      • 1.GPIO port
      • 2.Serial port
      • 3.Analog-digital converter
      • 4.Digital-Analog Converter
      • 5.EEPROM (Electrically Erasable Programmable read only memory)
      • 6.Gyro IMU(MPU6050)
      • 7.Infrared remote control
      • 8.PWM(Pulse Width Modulation)
      • 9.Servo(under construction)
      • 10.Classic Bluetooth serial port SPP
      • 11.Bluetooth low energy (BLE) serial port pass-through
      • 12.File system SPIFFS
      • 13.Add hardware partition configuration option in Arduino IDE
      • 14.Play MP3
      • 15.The usage of Wi-Fi OTA(Over-The-Air)
  • Communication Modules
    • Introduction
    • USB Uploader (CH340C or CH343G)
    • Dual Mode Bluetooth
    • WiFi ESP8266
      • ESP8266 + Python Scripts Implement wireless crowd control
  • Extensible Modules
    • Introduction
    • MU Camera
    • Ultrasonic Sensor
    • Light Sensor
    • Touch Sensor
    • Gesture Sensor
    • PIR Motion Sensor
  • Applications
    • Skill Creation
    • OpenCat Imitation Tutorial
    • Programmable Puppet Character
  • History
    • Upload Sketch For NyBoard (software 1.0)
  • Technical Support
    • 🛠️Supporting Application and Software
    • 🙋‍♂️FAQ(Frequently Asked Questions)
  • Useful Links 🕸
    • 🔭Official Site of Petoi
    • 💿GitHub of OpenCat
    • 🎪PetoiCamp (Forum)
Powered by GitBook
On this page

Was this helpful?

Export as PDF
  1. BIBOARD
  2. Demo Applications

7.Infrared remote control

Previous6.Gyro IMU(MPU6050)Next8.PWM(Pulse Width Modulation)

Last updated 2 years ago

Was this helpful?

BiBoard ติดตั้งเซ็นเซอร์อินฟราเรดซึ่งเชื่อมต่อกับพินที่ 23 การใช้อินฟราเรดนั้นเหมือนกับที่ใช้ใน Arduino UNO ที่ใช้ AVR

ก่อนอื่นให้ดาวน์โหลดไลบรารี IRremote เวอร์ชัน 2.6.1 คุณต้องเลือกเวอร์ชัน 2.6.1 ด้วยตนเอง เนื่องจากโค้ดที่เกี่ยวข้องกับอินฟราเรดมีการเปลี่ยนแปลงในเวอร์ชันหลังๆ หากคุณใช้เวอร์ชัน 3.X คำสั่งจะไม่ถูกแปล เพื่อให้เข้ากันได้กับผลิตภัณฑ์ก่อนหน้าของเรา เราตัดสินใจใช้เวอร์ชัน 2.6.1 หลังจากการทดสอบ

เมื่อใช้ NyBoard เพื่อให้แน่ใจว่าสามารถคอมไพล์โค้ดได้อย่างราบรื่น เราจำเป็นต้องลบโค้ดที่ไม่จำเป็นในไลบรารี IRremote นั่นคือ ลบตัวเข้ารหัส/ตัวถอดรหัสที่เราไม่ได้ใช้ และเก็บเฉพาะ NEC_DECODER ซึ่งก็คือ ตัวถอดรหัสสัญญาณ 38KHz ในรูปแบบ NEC

เนื่องจากความจุของหน่วยความจำแฟลชของ BiBoard นั้น “มหาศาล” เราจึงไม่จำเป็นต้องลบโค้ดที่ไม่จำเป็นในไลบรารี IRremote

สุดท้ายมีการแนบตัวอย่างซึ่งรับสัญญาณอินฟราเรดและพิมพ์ผ่านพอร์ตซีเรียล คุณยังสามารถใช้การตัวอย่าง อย่างเป็นทางการสำหรับการทดสอบ

#include <Arduino.h>
#include <IRremote.h>

int RECV_PIN = 23;

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup() {
  Serial.begin(115200);
  irrecv.enableIRIn();
  Serial.println("IR Receiver ready");
}

void loop() {
  if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX);
    Serial.print(" - ");
    irrecv.resume(); // Receive the next value
  }
  delay(300);
}

23% of flash is used on UNO
Only 4% of flash is used on BiBoard