Problem with U-int 32_t data

dear reader,
With an arduino Uno I want to switch on and of some pumps with an IR remote control.
When I use the program IRreceivedump.cpp from armin.joachimsmeyer@gmail.com
The program works. The intention is to find the hexadecimal code from the various numbers on the remote.
This works fine Every number gives a unique code.
I need to work with hexadecimal code behind Uint32_t data but I can not get this value in a variable.
does someone know a solution.
thanks in advance

IR_sketch_20.ino (6.1 KB)

More members will see your code if posted properly. Read the how get the most out of this forum sticky to see how to properly post code. Remove useless white space and format the code with the IDE autoformat tool (crtl-t or Tools, Auto Format) before posting code in code tags.

This example reads the remote and puts the key's code into the unsigned long (uint32_t) variable keycode and prints the HEX value (of command). The code ignores the repeat code. This works for my NEC remote.

#include <IRremote.h>

const byte IR_RECEIVE_PIN = 11;

void setup()
{
   Serial.begin(115200);
   Serial.println("IR receive test");
   IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK);
}

void loop()
{
   if (IrReceiver.decode())
   {
      unsigned long keycode = IrReceiver.decodedIRData.command;
      Serial.println(keycode, HEX);
      if ((IrReceiver.decodedIRData.flags & IRDATA_FLAGS_IS_REPEAT))
      {
         IrReceiver.resume();
         return;
      }
      IrReceiver.resume();
   }
}

What do you mean by "I need to work with hexadecimal code"? Hexadecimal is a human readable representation of a binary number, and all numbers in the computer are binary.

To declare and set a variable equal to some value, both of these statements give the same result:

uint32_t x = 0xFF;  //use hex notation
uint32_t x = 255;  //use decimal notation

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.