STM32F411 + IR приемник HX1838 - нет считывания

Добрый вечер всем!

На этот раз пытаюсь считать коды пульта для последующего использования.

Код;

#include <IRremote.h>

#define IR_PIN PB4
IRrecv ir(IR_PIN);
decode_results res;

void setup() {
  Serial.begin(9600);
  ir.enableIRIn();
}

void loop() {
  if (ir.decode(&res)) {
    Serial.println(res.value, HEX);
    ir.resume();
  }
}

Физическое подключение:

Спойлер

Спойлер

и ничего…

ССылку на библиотеку дайте. Какая версия библиотеки?
Или покажите лог компиляции

А что, приёмник действительно трёхвольтовый?

По даташиту и 3 и 5 вольт:

Спойлер

Сейчас не за компом, вечером лог покажу. Про ссылку на библиотеку - так стандартная же <IRremote.h>

Вы не представляете сколько их версий и сколько раз бывало, что программы переставали работать просто потому, что обновилась версия! Вот просто - обновилась – и не работает.

а как узнать ее версию?

Скорее всего, она написана в тексте, просто надо почитать. Но, Вас ведь попросили дать ссылку на то место, где Вы её брали. Вот и дайте, те, кто просил, сами узнают.

я ставил библиотеку непосредственно из IDE, из официального репозитория, вечером напишу лог компиляции и версию библиотеки.

Тогда в ИДЕ прямо в Менеджере библиотек и посмотрите версию. Еще версия пишется в конце лога компиляции , когда вы собираете скетч.

Почти наверняка у вас установлена версия 4. x, а тот код, что вы показали - от версии 2. x. Потому и не работает

Ну так правильно было бы взять пример из установленной библиотеки и пробовать. Благо примеров там почти 30 на разные вкусы.

Буду иметь ввиду - это нюансы, которые понимаешь со временем…

они там на всех углах орут, да и затычка есть

/**
 * @file IRremote.h
 *
 * @brief Stub for backward compatibility
 */

#ifndef IRremote_h
#define IRremote_h

#include "IRremote.hpp"

#warning It seems, that you are using an old version 2.0 code / example.
#warning This version is no longer supported!
#warning Upgrade instructions can be found here: "https://github.com/Arduino-IRremote/Arduino-IRremote?tab=readme-ov-file#converting-your-2x-program-to-the-4x-version"
#warning Please use one of the new code examples from the library, available at "File > Examples > Examples from Custom Libraries / IRremote".
#warning Start with the SimpleReceiver or SimpleSender example.
#warning The examples are documented here: "https://github.com/Arduino-IRremote/Arduino-IRremote?tab=readme-ov-file#examples-for-this-library"
#warning Or just downgrade your library to version 2.6.0.

/**********************************************************************************************************************
 * The OLD and DEPRECATED decode function with parameter aResults, kept for backward compatibility to old 2.0 tutorials
 * This function calls the old MSB first decoders and fills only the 3 variables:
 * aResults->value
 * aResults->bits
 * aResults->decode_type
 * It prints a message on the first call.
 **********************************************************************************************************************/
bool IRrecv::decode(decode_results *aResults) {
    static bool sMessageWasSent = false;
    if (!sMessageWasSent) {
        Serial.println(F("**************************************************************************************************"));
        Serial.println(F("Thank you for using the IRremote library!"));
        Serial.println(F("It seems, that you are using an old version 2.0 code / example."));
        Serial.println(F("This version is no longer supported!"));
        Serial.println();
        Serial.println(F("Upgrade instructions can be found here:"));
        Serial.println(F(" https://github.com/Arduino-IRremote/Arduino-IRremote?tab=readme-ov-file#converting-your-2x-program-to-the-4x-version"));
        Serial.println();
        Serial.println(F("Please use one of the new code examples from the library,"));
        Serial.println(F(" available at \"File > Examples > Examples from Custom Libraries / IRremote\"."));
        Serial.println(F("Start with the SimpleReceiver or SimpleSender example."));
        Serial.println(F("The examples are documented here:"));
        Serial.println(F(" https://github.com/Arduino-IRremote/Arduino-IRremote?tab=readme-ov-file#examples-for-this-library"));
        Serial.println();
        Serial.println(F("Or just downgrade your library to version 2.6.0."));
        Serial.println();
        Serial.println(F("Thanks"));
        Serial.println(F("**************************************************************************************************"));
        Serial.println();
        Serial.println();
        sMessageWasSent = true;
    }
    return decode_old(aResults);
}

#endif // IRremote_h
#pragma once

Начинаю понимать :)) #include <IRremote.hpp> нужно ну и далее по тексту.

Версия библиотеки:

Спойлер

Лог компиляции:

Sketch uses 40916 bytes (7%) of program storage space. Maximum is 524288 bytes.
Global variables use 7132 bytes (5%) of dynamic memory, leaving 123940 bytes for local variables. Maximum is 131072 bytes.
xPack Open On-Chip Debugger 0.12.0+dev-01850-geb6f2745b-dirty (2025-02-07-10:08)
Licensed under GNU GPL v2
For bug reports, read

debug_level: 0
Error: couldn’t bind gdb to socket on port 3333: No error
[stm32f4x.cpu] halted due to breakpoint, current mode: Thread
xPSR: 0x01000000 pc: 0x08007b3c msp: 0x20020000
** Programming Started **
** Programming Finished **
** Verify Started **
** Verified OK **
** Resetting Target **
shutdown command invoked

В итоге вы правы! Дело было в старой версии, сейчас все выдает, всем оргомное спасибо!