Please help I'm new

Hello, I am new to c++ and arduino

Getting this error while compiling a sketch:`

exit status 1

expected initializer before '.' token

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

This is the code: `
#include <IRremote.h>

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

void setup() {
// put your setup code here, to run once:

void loop() {
// put your main code here, to run repeatedly:
if (irrecv.decode(&results)){
int results.value = results;
Serial.println(" ");
Serial.println("Code: ");
Serial.println(" ");

On that line?
sp."uint32_t result = results.value;"

Please remember to use code tags when posting code, and please remember to post the error message you see. All of it

That line is backwards. You cannot give the value member of the results struct a value. You can give a variable with a different name the value of the value member of the results struct. The data type of results.value is unsigned long. You can't use results as a variable name. It is used by the IRremote library. So something like:

      unsigned long keycode = results.value ;
      Serial.println(" ");
      Serial.println("Code: ");
      Serial.println(keycode);  //results.value);
      Serial.println(" ");

What version of the IRremote library are you using? That code is written for the older version (< 3.0) of the library and may not work right. You can either change your code to work with the new version of the library, following the instructions on the IRremote github page or you can delete the new version of the IRremote library from your sketchbook/libraries folder and install an older version (2.x.x) and keep the code the way that it is. The older versions are available for install from the IDE library manager.

Read the forum guidelines to see how to properly post code.
Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.

Please include the entire error message. It is easy to do. There is a button (lower right of the IDE window) called "copy error message". Copy the error and paste into a post in code tags. Paraphrasing the error message leaves out important information.

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