• Уважаемые посетители сайта esp8266.ru!
    Мы отказались от размещения рекламы на страницах форума для большего комфорта пользователей.
    Вы можете оказать посильную поддержку администрации форума. Данные средства пойдут на оплату услуг облачных провайдеров для сайта esp8266.ru
  • Система автоматизации с открытым исходным кодом на базе esp8266/esp32 микроконтроллеров и приложения IoT Manager. Наша группа в Telegram

Передача данных на экран дисплея 1602

saharesp

New member
Схема состоит из: ESP8266, IR-приемник, дисплей 1602 с I2C интерфейсом. Хочу передать сигнал, полученный с IR - приемника на экран. Ниже приведенный скетч рабочий, позволяет принять сигнал с IR-приемника, вывести его в монитор порта Arduino IDE. Но не получается вывести его на дисплей 1602. Хотя пробное сообщение выводится. Видимо нужно как-то преобразовать сигнал, полученный с IR-приемника, но у меня не получается. В скетче это последняя закомментированная строчка в void loop. Помогите вывести сигнал на экран 1602.

/*
* IRremoteESP8266: IRrecvDemo - demonstrates receiving IR codes with IRrecv
* This is very simple teaching code to show you how to use the library.
* If you are trying to decode your Infra-Red remote(s) for later replay,
* use the IRrecvDumpV2.ino (or later) example code instead of this.
* An IR detector/demodulator must be connected to the input kRecvPin.
* Copyright 2009 Ken Shirriff, http://arcfn.com
* Example circuit diagram:
* https://github.com/crankyoldgit/IRremoteESP8266/wiki#ir-receiving
* Changes:
* Version 0.2 June, 2017
* Changed GPIO pin to the same as other examples.
* Used our own method for printing a uint64_t.
* Changed the baud rate to 115200.
* Version 0.1 Sept, 2015
* Based on Ken Shirriff's IrsendDemo Version 0.1 July, 2009
*/
#include <Arduino.h>
#include <IRremoteESP8266.h>
#include <IRrecv.h>
#include <IRutils.h>
// An IR detector/demodulator is connected to GPIO pin 14(D5 on a NodeMCU
// board).
// Note: GPIO 16 won't work on the ESP8266 as it does not have interrupts.
// Note: GPIO 14 won't work on the ESP32-C3 as it causes the board to reboot.
#ifdef ARDUINO_ESP32C3_DEV
const uint16_t kRecvPin = 10; // 14 on a ESP32-C3 causes a boot loop.
#else // ARDUINO_ESP32C3_DEV
const uint16_t kRecvPin = 14;
#endif // ARDUINO_ESP32C3_DEV
IRrecv irrecv(kRecvPin);
decode_results results;
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
Serial.begin(115200);
irrecv.enableIRIn(); // Start the receiver
while (!Serial) // Wait for the serial connection to be establised.
delay(50);
Serial.println();
Serial.print("IRrecvDemo is now running and waiting for IR message on Pin ");
Serial.println(kRecvPin);
lcd.begin(4,5);
// lcd.backlight();
lcd.print("Hello!");
}
void loop() {
if (irrecv.decode(&results)) {
// print() & println() can't handle printing long longs. (uint64_t)
serialPrintUint64(results.value, HEX);
Serial.println("");
irrecv.resume(); // Receive the next value
lcd.clear();
lcd.print("OK");
// lcd.write(irrecv.resume, HEX);
}
delay(100);
}
 

saharesp

New member
CodeNameHawk, спасибо за подсказку. В библиотеках я не силен (моя большая боль), но Гугл мне помог. Все работает.
 
Сверху Снизу