I'm a little dumbfounded as to why this isn't working. I keep getting the following linker error:
In file included from src\ac.cpp:1:0:
src/ac.h:9:21: error: expected identifier before numeric constant
#define RECEIVE_PIN 0
^
src/ac.h:14:26: note: in expansion of macro 'RECEIVE_PIN'
static IRrecv irrecv(RECEIVE_PIN);
^
src/ac.h:9:21: error: expected ',' or '...' before numeric constant
#define RECEIVE_PIN 0
^
src/ac.h:14:26: note: in expansion of macro 'RECEIVE_PIN'
static IRrecv irrecv(RECEIVE_PIN);
^
*** [.pio\build\esp32cam\src\ac.cpp.o] Error 1
*** [.pio\build\esp32cam\src\main.cpp.o] Error 1
I am simply trying to initialize the IR receiver with static IRrecv irrecv(RECEIVE_PIN);, but the compiler is refusing to link it together.
#ifndef _AC_H_
#define _AC_H_
#include <Arduino.h>
#include <IRremoteESP8266.h>
#include <IRrecv.h>
#include <IRutils.h>
#define RECEIVE_PIN 0
class IR
{
public:
static IRrecv irrecv(RECEIVE_PIN);
static decode_results results;
void initRecv();
bool waitForIR();
};
extern IR ir;
#endif
If I do static IRrecv irrecv; it successfully compiles, but I'm unsure if I can pass the pin variable after the fact.