Home > Back-end >  save IR signals(like 89KZ3H) into a variable(like string)
save IR signals(like 89KZ3H) into a variable(like string)

Time:05-20

I want to start an IR remote controlled car, but since I'm not very good at programming with c in Visual studio code I wanted to know how to save a signal that is transmitted by the remote control to my arduino and save it into a string variable. I copied this code from internet to get the IR signals:

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

int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;

void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
}

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

Now, how do I save "results.value, HEX" like into a String?

CodePudding user response:

String myString = String(results.value);

  • Related