Compiling my Project brings a RAWBUF' was not declared in this scope uint16_t

Hy pro's,

i become from the following code at compiling so very bad errors......

Hardware nodemcu V3 , Arduino IDE 1.8.8, IDE Parameter Generic esp8266 module

Sketch

#include <IRremoteESP8266.h>
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <IRrecv.h>
#include <IRsend.h>
#include <IRutils.h>


int RECV_PIN = 5; // =ESP8266 Pin D1 verbunden mit OUT des OS-1838B
IRrecv irrecv(RECV_PIN);
decode_results results;
// Netzwerk Einstellungen
const char* ssid = ""; //SSID des WLAN
const char* password = ""; //Passwort des WLAN

const char* host = ""; //IP des Servers, der die IR Codes an ein Unterhaltungsgerät schickt

IPAddress ip(); //Feste IP des Servers, frei wählbar, muss mit Client Sketch übereinstimmen (Variable host)
IPAddress gateway(); //Gatway (IP Router eintragen)
IPAddress subnet(255,255,255,0); //Subnet Maske

WiFiClient client;


uint16_t rawCodes[RAWBUF]; // [The durations if raw]
int codeLen; // [The length of the code]

//[Get the infrared codes from remote]
void storeCode(decode_results *results)
{
  int count = results->rawlen;
  Serial.println("IR Codes empfangen");
  codeLen = results->rawlen - 1;
  for (int i = 1; i <= codeLen; i++)
    {
      if (i % 2)
        {
          rawCodes[i - 1] = results->rawbuf[i]*USECPERTICK - MARK_EXCESS;  // Mark
          Serial.print(" m");
        }
      else
        {
          rawCodes[i - 1] = results->rawbuf[i]*USECPERTICK + MARK_EXCESS;  // Space
          Serial.print(" s");
        }
      Serial.print(rawCodes[i - 1], DEC);
    }
  Serial.println("");
}

void setup()
{
  Serial.begin(115200);  // debugging
  WiFi.begin(ssid, password);  // WLAN starten
  WiFi.config(ip, gateway, subnet);
  Serial.println("WiFi Verbindung wird aufgebaut");
  while (WiFi.status() != WL_CONNECTED)
    {
      delay(500);
      Serial.print(".");
    }
  Serial.println("");
  Serial.print("Eigene IP des ESP-Modul: ");
  Serial.println(WiFi.localIP());
  irrecv.enableIRIn(); // Receiver starten FEHLT IM ORIGINAL SKETCH!!!
}


void sendIR()  //senden der IR Codes über WLAN
{
  if (client.connect(host, 80))
    {
      Serial.println("Sende Codes"); // debugging
      client.print("GET /");
      for (int i = 0; i < codeLen; i++)
      {
        client.print(rawCodes[i]);
      }
      client.println(" HTTP/1.1");
      client.println("Hallo Server"); // debugging
      client.println();
      client.println();
      client.stop();
    }
  else // debugging
    {
      Serial.println("Keine Verbindung zum Server");
    }
}

void loop()
{
  if (irrecv.decode(&results))
  {
    storeCode(&results);
    sendIR();
    irrecv.resume(); // Receive the next value
  }
}

Errors

irSender:44:19: error: 'RAWBUF' was not declared in this scope

 uint16_t rawCodes[RAWBUF]; // [The durations if raw]

                   ^

C:\Users\Lenovo\AppData\Local\Temp\arduino_modified_sketch_244984\irSender.ino: In function 'void storeCode(decode_results*)':

irSender:57:11: error: 'rawCodes' was not declared in this scope

           rawCodes[i - 1] = results->rawbuf[i]*USECPERTICK - MARK_EXCESS;  // Mark

           ^

irSender:57:48: error: 'USECPERTICK' was not declared in this scope

           rawCodes[i - 1] = results->rawbuf[i]*USECPERTICK - MARK_EXCESS;  // Mark

                                                ^

irSender:57:62: error: 'MARK_EXCESS' was not declared in this scope

           rawCodes[i - 1] = results->rawbuf[i]*USECPERTICK - MARK_EXCESS;  // Mark

                                                              ^

irSender:62:11: error: 'rawCodes' was not declared in this scope

           rawCodes[i - 1] = results->rawbuf[i]*USECPERTICK + MARK_EXCESS;  // Space

           ^

irSender:62:48: error: 'USECPERTICK' was not declared in this scope

           rawCodes[i - 1] = results->rawbuf[i]*USECPERTICK + MARK_EXCESS;  // Space

                                                ^

irSender:62:62: error: 'MARK_EXCESS' was not declared in this scope

           rawCodes[i - 1] = results->rawbuf[i]*USECPERTICK + MARK_EXCESS;  // Space

                                                              ^

irSender:65:20: error: 'rawCodes' was not declared in this scope

       Serial.print(rawCodes[i - 1], DEC);

                    ^

C:\Users\Lenovo\AppData\Local\Temp\arduino_modified_sketch_244984\irSender.ino: In function 'void sendIR()':

irSender:96:22: error: 'rawCodes' was not declared in this scope

         client.print(rawCodes[i]);

                      ^

exit status 1
'RAWBUF' was not declared in this scope

Could anybody say whats wrong with the code, i didn't have no more newbeeideas what can i do.

Thx

Where is RAWBUF declared and what should its value be and the same for each of the other error messages pertaining to undeclared variables

Re,

how should i do this declaration, i didnt find any democode where this ist in an example?

could you help me with an snip?

thy

could you help me with an snip?

const byte RAWBUF = 16;

or maybe

#define RAWBUF 16

But those suggestions are no good if you don't understand them
Where did you get the code from ?

Re Thy for the answer,

but there must be a bigger probem.

These are the new errors:

irSender:58:48: error: 'USECPERTICK' was not declared in this scope

rawCodes[i - 1] = results->rawbuf*USECPERTICK - MARK_EXCESS; // Mark

  • ^*
    irSender:58:62: error: 'MARK_EXCESS' was not declared in this scope
    rawCodes[i - 1] = results->rawbufUSECPERTICK - MARK_EXCESS; // Mark
    _
    ^_
    irSender:63:48: error: 'USECPERTICK' was not declared in this scope
    rawCodes[i - 1] = results->rawbufUSECPERTICK + MARK_EXCESS; // Space
    _ ^

    irSender:63:62: error: 'MARK_EXCESS' was not declared in this scope
    rawCodes[i - 1] = results->rawbuf*USECPERTICK + MARK_EXCESS; // Space
    * ^
    exit status 1
    'USECPERTICK' was not declared in this scope*_

Re Thy for the answer,

but there must be a bigger probem.

I am sure there is. So where did you get the code from ?

https://forum.arduino.cc/index.php?topic=527410.0

here is it from.

I would suspect that something is wrong with the version of the library that you installed.

All those undefined values are from the iRemote library, so somewhere along the way you may have (in most obvious order)
a) not installed the library properly
b) might have 2 versions installed
c) not used the official release but someone's 'improved' version

Re good morning,

thx for the reply, so i am not possible to do my project with my knowing.