Please help, im going crazy

What's up guys I'm going insane cause I can't figure out how to fix my code

#include <IRremote.hpp>
#include <Servo.h>

int IRpin = 2;
int servoPin = 9;
int photoPin = A0;
int pushButtonPin = 7;

int servoAngle = 0;
int photoValue = 0;

IRrecv receiver(IRpin);
Servo servo; // Declare the Servo object
decode_results results; // Declare the decode_results object

// Define a custom IR remote code for rewind
const unsigned long REWIND_CODE = 0x40BF4319;

void setup() {
  Serial.begin(9600);
  receiver.enableIRIn(); // Call enableIRIn without arguments
  servo.attach(servoPin);
  pinMode(photoPin, INPUT);
  pinMode(pushButtonPin, INPUT_PULLUP);
}

void loop() {
  photoValue = analogRead(photoPin);
  if (photoValue < 300) {
    servoAngle = 180;
  } else {
    servoAngle = 0;
  }

  if (digitalRead(pushButtonPin) == LOW) {
    servoAngle = (servoAngle == 0) ? 180 : 0;
  }

  servo.write(servoAngle);

  if (receiver.decode(&results)) {
    switch (results.value) {
      case IRremote::KEY_FF:
        servoAngle = 180;
        break;
      case REWIND_CODE:
        servoAngle = 0;
        break;
    }
    servo.write(servoAngle);
    receiver.resume();
  }
}

This is the error i get: case IRremote::KEY_FF:
^~~~~~~~

exit status 1

Compilation error: 'IRremote' has not been declared

  • Is this a integer ?

Well, yes, that's to be expected. A quick glance through the IRremote library does not reveal a class called IRremote. In addition, nor does it reveal a constant called KEY_FF anywhere.

It would be a good idea to determine what values your remote actually returns, and work only with those values.

When I try to compile it there are other errors. Use default warnings and verbose log. Post here between code tags.

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