IRTemp example not working

Our range of tiny modules are designed to make it easy for you to quickly add functionality to your projects. [Module List]
Post Reply
lopemann
Posts: 1
Joined: Mon Feb 22, 2016 4:47 am

IRTemp example not working

Post by lopemann » Mon Feb 22, 2016 4:50 am

Below is the code given in the example file.
The issue is I keep getting error like this and I couldn't figure out the problem

In function 'void loop()':

readTemperature:28: error: 'printTemperature' was not declared in this scope

printTemperature("IR", irTemperature);

^

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

Code: Select all

/*
 * File:    readTemperature.ino
 * Author:  Andy Gelme (@geekscape) & Angus Gratton (angus at freetronics. com)
 * License: GPLv3
 *
 * For more information see www.freetronics.com/irtemp
 *
 */

#include "IRTemp.h"

static const byte PIN_DATA    = 2; // Choose any pins you like for these
static const byte PIN_CLOCK   = 3;
static const byte PIN_ACQUIRE = 4;

static const TempUnit SCALE=CELSIUS;  // Options are CELSIUS, FAHRENHEIT

IRTemp irTemp(PIN_ACQUIRE, PIN_CLOCK, PIN_DATA);

void setup(void) {
  Serial.begin(9600);
  Serial.println("IRTemp example");
  Serial.println("~~~~~~~~~~~~~~");
}

void loop(void) {
  float irTemperature = irTemp.getIRTemperature(SCALE);
  printTemperature("IR", irTemperature);

  float ambientTemperature = irTemp.getAmbientTemperature(SCALE);
  printTemperature("Ambient", ambientTemperature);

  delay(1000);
}

void printTemperature(
  char  *type,
  float  temperature) {

  Serial.print(type);
  Serial.print(" temperature: ");

  if (isnan(temperature)) {
    Serial.println("Failed");
  }
  else {
    Serial.print(temperature);
    Serial.println(SCALE == FAHRENHEIT  ?  " F"  :  " C");
  }
}

andrew
Freetronics Staff
Freetronics Staff
Posts: 978
Joined: Sun Jul 14, 2013 7:06 am
Location: Melbourne, Australia
Contact:

Re: IRTemp example not working

Post by andrew » Mon Feb 22, 2016 6:39 am

There seems to be an issue with Arduino v1.6.7 at the moment.
In the meanwhile please use Arduino IDE v1.6.5 for the time being.
https://www.arduino.cc/en/Main/OldSoftw ... s#previous

llag
Posts: 2
Joined: Thu Apr 21, 2016 4:08 am

Re: IRTemp example not working

Post by llag » Thu Apr 21, 2016 4:52 am

I had the same problem as lopemann so I installed Arduino IDE v1.6.5 however I am now getting "invalid reading" when I check the serial monitor.

Any guidance?

andrew
Freetronics Staff
Freetronics Staff
Posts: 978
Joined: Sun Jul 14, 2013 7:06 am
Location: Melbourne, Australia
Contact:

Re: IRTemp example not working

Post by andrew » Thu Apr 21, 2016 7:43 am

llag wrote:I had the same problem as lopemann so I installed Arduino IDE v1.6.5 however I am now getting "invalid reading" when I check the serial monitor.

Any guidance?
Have you soldered wires to the IRtemp?

llag
Posts: 2
Joined: Thu Apr 21, 2016 4:08 am

Re: IRTemp example not working

Post by llag » Thu Apr 21, 2016 8:09 am

Yes I soldered the wires directly to the IRTemp

andrew
Freetronics Staff
Freetronics Staff
Posts: 978
Joined: Sun Jul 14, 2013 7:06 am
Location: Melbourne, Australia
Contact:

Re: IRTemp example not working

Post by andrew » Thu Apr 21, 2016 9:05 pm

You may have a faulty unit. Please email support@freetronics.com.

Interalia
Posts: 6
Joined: Mon Apr 04, 2016 5:29 am

Re: IRTemp example not working

Post by Interalia » Sat Apr 23, 2016 4:00 am

Same issue, no wires soldered on, Arduino 1.6.8

angusgr
Freetronics Staff
Freetronics Staff
Posts: 853
Joined: Tue Apr 09, 2013 11:19 pm
Location: Melbourne, Australia
Contact:

Re: IRTemp example not working

Post by angusgr » Tue May 03, 2016 6:14 am

Interalia wrote:Same issue, no wires soldered on, Arduino 1.6.8
Sorry to hear the IRTemp isn't working properly. If you've tried everything mentioned in this thread then please contact us at the support email listed above.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests