"translateIR" was not declared in this scope

Hey everyone,

I’m having a strange issue with a int at the beginning of a loop not being declared, I put in globally and still had the same issues…

I’m basically having a thermocouple read a temp, display it, and have it turn on a relay if it drops below a certain temp.

The IR remote is suppose to be the input to my desired temp, and that’s the part of the code I am having issues with.

Not sure what to do at this point. Can anyone see any problems with this code? By itself, the IR code works just fine.

#include <IRremote.h>
#include "Adafruit_MAX31855.h"
#include <SPI.h>
#include <Wire.h>  
#include <LiquidCrystal_I2C.h>

#define MAXDO   3
#define MAXCS   4
#define MAXCLK  5

Adafruit_MAX31855 thermocouple(MAXCLK, MAXCS, MAXDO);

int RECV_PIN = 11;

int i = 0;

IRrecv irrecv(RECV_PIN);
decode_results results;

LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x3F for an LCD with 16 columns and 2 rows

void setup() {
irrecv.enableIRIn(); // Start the receiver

lcd.init();                     // initialize the lcd 
 lcd.setBacklight(HIGH);         // turn the LCD backlight on (HIGH is on, LOW is off) 
   lcd.setCursor(0,0);             // go to column 0, row 0

      lcd.print("Set Temp:");    //Set Temprature by User
   lcd.setCursor(0,1);             // go to column 0, row 1
      lcd.print("Temprature:"); //Current Temprature
  pinMode(13, OUTPUT);
  pinMode(12, OUTPUT);


void loop() { 

  // If a key was pressed then do the following
  if (irrecv.decode(&results)) {
    int numPressed = translateIR();
    // Print it if its not the default value
    if (numPressed != 9999) {
      Serial.print(results.value, HEX);

if (numPressed > 200){

  double c = thermocouple.readCelsius();


   if (c < numPressed) {

   if (c > numPressed) {
   irrecv.resume(); // Receive the next value

  int translateIR() {
  int key;
  switch (results.value) {
    case 0xFF6897: key = 0; break;
    case 0xFF30CF: key = 200; break;
    case 0xFF18E7: key = 220; break;
    case 0xFF7A85: key = 230; break;
    case 0xFF10EF: key = 240; break;
    case 0xFF38C7: key = 250; break;
    case 0xFF5AA5: key = 260; break;
    case 0xFF42BD: key = 270; break;
    case 0xFF4AB5: key = 280; break;
    case 0xFF52AD: key = 290; break;
    default: key = 9999;
  return key;


like text,

is really hard to read when it wanders

all over the page.

Check your {} braces/