Questions about the CT Code

Hey everyone,

 

On the website there is an example using the SCT-013-000 Current sensor interacting with an Arduino board. The instruction tell me to import both Emon.h and Emon.cpp libraries into my arduino folder but I am having difficulties compiling the code. I am getting the following errors. 

The link to the example can be found here: http://openenergymonitor.org/emon/node/58

 

In file included from sketch_mar22a.cpp:1:
\Arduino\libraries\Emon/EmonLib.h:9: error: stray '\302' in program
\Arduino\libraries\Emon/EmonLib.h:9: error: stray '\267' in program
\Arduino\libraries\Emon/EmonLib.h:9: error: stray '\302' in program
\Arduino\libraries\Emon/EmonLib.h:9: error: stray '\267' in program
\Arduino\libraries\Emon/EmonLib.h:145: error: missing terminating ' character
\Arduino\libraries\Emon/EmonLib.h:147: error: stray '\342' in program
\Arduino\libraries\Emon/EmonLib.h:147: error: stray '\206' in program
\Arduino\libraries\Emon/EmonLib.h:147: error: stray '\221' in program
\Arduino\libraries\Emon/EmonLib.h:148: error: stray '\342' in program
\Arduino\libraries\Emon/EmonLib.h:148: error: stray '\206' in program
\Arduino\libraries\Emon/EmonLib.h:148: error: stray '\223' in program
In file included from sketch_mar22a.cpp:1:
\Arduino\libraries\Emon/EmonLib.h:251:50: error: invalid suffix "f08090133eb749ee4f0663" on floating constant
\Arduino\libraries\Emon/EmonLib.h:264: error: stray '\342' in program
\Arduino\libraries\Emon/EmonLib.h:264: error: stray '\200' in program
\Arduino\libraries\Emon/EmonLib.h:264: error: stray '\246' in program
\Arduino\libraries\Emon/EmonLib.h:387: error: stray '#' in program
\Arduino\libraries\Emon/EmonLib.h:387: error: stray '#' in program
\Arduino\libraries\Emon/EmonLib.h:387: error: stray '#' in program
\Arduino\libraries\Emon/EmonLib.h:387: error: stray '#' in program
\Arduino\libraries\Emon/EmonLib.h:387: error: stray '#' in program
\Arduino\libraries\Emon/EmonLib.h:387: error: stray '#' in program
\Arduino\libraries\Emon/EmonLib.h:387: error: stray '#' in program
\Arduino\libraries\Emon/EmonLib.h:467: error: stray '#' in program
\Arduino\libraries\Emon/EmonLib.h:467: error: stray '#' in program
\Arduino\libraries\Emon/EmonLib.h:480: error: stray '#' in program
\Arduino\libraries\Emon/EmonLib.h:631: error: stray '\342' in program
\Arduino\libraries\Emon/EmonLib.h:631: error: stray '\206' in program
\Arduino\libraries\Emon/EmonLib.h:631: error: stray '\220' in program
\Arduino\libraries\Emon/EmonLib.h:635: error: stray '\342' in program
\Arduino\libraries\Emon/EmonLib.h:635: error: stray '\206' in program
\Arduino\libraries\Emon/EmonLib.h:635: error: stray '\222' in program
\Arduino\libraries\Emon/EmonLib.h:639: error: stray '\342' in program
\Arduino\libraries\Emon/EmonLib.h:639: error: stray '\206' in program
\Arduino\libraries\Emon/EmonLib.h:639: error: stray '\221' in program
\Arduino\libraries\Emon/EmonLib.h:643: error: stray '\342' in program
\Arduino\libraries\Emon/EmonLib.h:643: error: stray '\206' in program
\Arduino\libraries\Emon/EmonLib.h:643: error: stray '\223' in program
\Arduino\libraries\Emon/EmonLib.h:653: error: stray '\342' in program
\Arduino\libraries\Emon/EmonLib.h:653: error: stray '\206' in program
\Arduino\libraries\Emon/EmonLib.h:653: error: stray '\220' in program
\Arduino\libraries\Emon/EmonLib.h:657: error: stray '\342' in program
\Arduino\libraries\Emon/EmonLib.h:657: error: stray '\206' in program
\Arduino\libraries\Emon/EmonLib.h:657: error: stray '\222' in program
\Arduino\libraries\Emon/EmonLib.h:661: error: stray '\342' in program
\Arduino\libraries\Emon/EmonLib.h:661: error: stray '\206' in program
\Arduino\libraries\Emon/EmonLib.h:661: error: stray '\221' in program
\Arduino\libraries\Emon/EmonLib.h:665: error: stray '\342' in program
\Arduino\libraries\Emon/EmonLib.h:665: error: stray '\206' in program
\Arduino\libraries\Emon/EmonLib.h:665: error: stray '\223' in program
\Arduino\libraries\Emon/EmonLib.h:708:3: error: invalid preprocessing directive #This
\Arduino\libraries\Emon/EmonLib.h:709: error: stray '##' in program
\Arduino\libraries\Emon/EmonLib.h:710: error: stray '##' in program
\Arduino\libraries\Emon/EmonLib.h:710: error: stray '##' in program
\Arduino\libraries\Emon/EmonLib.h:710: error: stray '##' in program
\Arduino\libraries\Emon/EmonLib.h:727:10: error: invalid suffix "a" on integer constant
\Arduino\libraries\Emon/EmonLib.h:728:10: error: invalid suffix "b" on integer constant
\Arduino\libraries\Emon/EmonLib.h:734:11: error: invalid suffix "a" on integer constant
\Arduino\libraries\Emon/EmonLib.h:735:11: error: invalid suffix "b" on integer constant
\Arduino\libraries\Emon/EmonLib.h:752: error: missing terminating ' character
\Arduino\libraries\Emon/EmonLib.h:763: error: stray '`' in program
\Arduino\libraries\Emon/EmonLib.h:763: error: stray '`' in program
\Arduino\libraries\Emon/EmonLib.h:763: error: stray '`' in program
\Arduino\libraries\Emon/EmonLib.h:766: error: stray '$' in program
\Arduino\libraries\Emon/EmonLib.h:769: error: stray '`' in program
\Arduino\libraries\Emon/EmonLib.h:769: error: stray '`' in program
\Arduino\libraries\Emon/EmonLib.h:769: error: stray '`' in program
\Arduino\libraries\Emon/EmonLib.h:785: error: stray '`' in program
\Arduino\libraries\Emon/EmonLib.h:785: error: stray '`' in program
\Arduino\libraries\Emon/EmonLib.h:4: error: expected unqualified-id before '<' token
\Arduino\libraries\Emon/EmonLib.h:127: error: expected constructor, destructor, or type conversion before '<' token
\Arduino\libraries\Emon/EmonLib.h:154: error: expected unqualified-id before '<' token
\libraries\Emon/EmonLib.h:387: error: expected constructor, destructor, or type conversion before ';' token
\Arduino\libraries\Emon/EmonLib.h:387: error: expected unqualified-id before numeric constant
\Arduino\libraries\Emon/EmonLib.h:387: error: expected unqualified-id before '=' token
\libraries\Emon/EmonLib.h:387: error: expected constructor, destructor, or type conversion before '.' token
\Arduino\libraries\Emon/EmonLib.h:387: error: expected unqualified-id before '<' token
\libraries\Emon/EmonLib.h:387: error: expected constructor, destructor, or type conversion before '.' token
\Arduino\libraries\Emon/EmonLib.h:387: error: expected unqualified-id before '<' token
 

 

thecounterarts's picture

Re: Questions about the CT Code

Sorry guys for the long errors. I appreciate it. 

glyn.hudson's picture

Re: Questions about the CT Code

Which example are you trying to run 'current only' or 'voltage and current'? They both compile fine for me. Are you using Arduino 1.0. You will need to restart the IDE after installing the library. 

thecounterarts's picture

Re: Questions about the CT Code

i just found the problem. The .h and .cpp files needed to be in ANSI and they were in UTF-8 Format.

 

 

 

Nico2012's picture

Re: Questions about the CT Code

 hello, how do you convert utf-8 to ansi? or where can I find the files with the right format ???

Thank you

Robert Wall's picture

Re: Questions about the CT Code

Any half-decent text editor will do the conversion for you. I use Notepad++ most of the time - that can certainly do the conversion (though I've never needed to).

Nico2012's picture

Re: Questions about the CT Code

 Hello, I've downloaded the notepad ++ and converted to ansi format and still I am getting the following error messages.. less than before, but stilll enough and the compilation can't be done

 

C:\Users\Nico\Downloads\arduino-1.0.1\libraries\EmonLib\EmonLib.cpp:9: error: stray '\267' in program

C:\Users\Nico\Downloads\arduino-1.0.1\libraries\EmonLib\EmonLib.cpp:145: error: missing terminating ' character

C:\Users\Nico\Downloads\arduino-1.0.1\libraries\EmonLib\EmonLib.cpp:619: error: stray '#' in program

C:\Users\Nico\Downloads\arduino-1.0.1\libraries\EmonLib\EmonLib.cpp:619: error: stray '#' in program

C:\Users\Nico\Downloads\arduino-1.0.1\libraries\EmonLib\EmonLib.cpp:632: error: stray '#' in program

C:\Users\Nico\Downloads\arduino-1.0.1\libraries\EmonLib\EmonLib.cpp:879:3: error: invalid preprocessing directive #This

C:\Users\Nico\Downloads\arduino-1.0.1\libraries\EmonLib\EmonLib.cpp:880: error: stray '##' in program

C:\Users\Nico\Downloads\arduino-1.0.1\libraries\EmonLib\EmonLib.cpp:881: error: stray '##' in program

C:\Users\Nico\Downloads\arduino-1.0.1\libraries\EmonLib\EmonLib.cpp:881: error: stray '##' in program

C:\Users\Nico\Downloads\arduino-1.0.1\libraries\EmonLib\EmonLib.cpp:881: error: stray '##' in program

C:\Users\Nico\Downloads\arduino-1.0.1\libraries\EmonLib\EmonLib.cpp:898:10: error: invalid suffix "a" on integer constant

C:\Users\Nico\Downloads\arduino-1.0.1\libraries\EmonLib\EmonLib.cpp:899:10: error: invalid suffix "b" on integer constant

C:\Users\Nico\Downloads\arduino-1.0.1\libraries\EmonLib\EmonLib.cpp:905:11: error: invalid suffix "a" on integer constant

C:\Users\Nico\Downloads\arduino-1.0.1\libraries\EmonLib\EmonLib.cpp:906:11: error: invalid suffix "b" on integer constant

C:\Users\Nico\Downloads\arduino-1.0.1\libraries\EmonLib\EmonLib.cpp:923: error: missing terminating ' character

C:\Users\Nico\Downloads\arduino-1.0.1\libraries\EmonLib\EmonLib.cpp:934: error: stray '`' in program

C:\Users\Nico\Downloads\arduino-1.0.1\libraries\EmonLib\EmonLib.cpp:934: error: stray '`' in program

C:\Users\Nico\Downloads\arduino-1.0.1\libraries\EmonLib\EmonLib.cpp:934: error: stray '`' in program

C:\Users\Nico\Downloads\arduino-1.0.1\libraries\EmonLib\EmonLib.cpp:937: error: stray '$' in program

C:\Users\Nico\Downloads\arduino-1.0.1\libraries\EmonLib\EmonLib.cpp:940: error: stray '`' in program

C:\Users\Nico\Downloads\arduino-1.0.1\libraries\EmonLib\EmonLib.cpp:940: error: stray '`' in program

C:\Users\Nico\Downloads\arduino-1.0.1\libraries\EmonLib\EmonLib.cpp:940: error: stray '`' in program

C:\Users\Nico\Downloads\arduino-1.0.1\libraries\EmonLib\EmonLib.cpp:956: error: stray '`' in program

C:\Users\Nico\Downloads\arduino-1.0.1\libraries\EmonLib\EmonLib.cpp:956: error: stray '`' in program

C:\Users\Nico\Downloads\arduino-1.0.1\libraries\EmonLib\EmonLib.cpp:4: error: expected unqualified-id before '<' token

C:\Users\Nico\Downloads\arduino-1.0.1\libraries\EmonLib\EmonLib.cpp:154: error: expected unqualified-id before '<' token

C:\Users\Nico\Downloads\arduino-1.0.1\libraries\EmonLib\EmonLib.cpp:574: error: expected constructor, destructor, or type conversion before '<' token

C:\Users\Nico\Downloads\arduino-1.0.1\libraries\EmonLib\EmonLib.cpp:618: error: expected unqualified-id before numeric constant

C:\Users\Nico\Downloads\arduino-1.0.1\libraries\EmonLib\EmonLib.cpp:627: error: expected unqualified-id before '<' token

C:\Users\Nico\Downloads\arduino-1.0.1\libraries\EmonLib\EmonLib.cpp:880: error: expected constructor, destructor, or type conversion before '&' token

C:\Users\Nico\Downloads\arduino-1.0.1\libraries\EmonLib\EmonLib.cpp:880: error: 'tag' does not name a type

C:\Users\Nico\Downloads\arduino-1.0.1\libraries\EmonLib\EmonLib.cpp:881: error: expected constructor, destructor, or type conversion before '&' token

C:\Users\Nico\Downloads\arduino-1.0.1\libraries\EmonLib\EmonLib.cpp:881: error: expected constructor, destructor, or type conversion before '<' token

 

Robert Wall's picture

Re: Questions about the CT Code

Where did you get the files from? Which exact version?

My Line 9 is a blank line, and line 145 is a comment (your first 2 errors), and my last line number is 223. So I think your EmonLib.cpp is not the same as mine.

Here is what the start of EmonLib.cpp looks like:

/*
  Emon.cpp - Library for openenergymonitor
  Created by Trystan Lea, April 27 2010
  GNU GPL
*/

//#include "WProgram.h" un-comment for use on older versions of Arduino IDE
#include "EmonLib.h"

#if defined(ARDUINO) && ARDUINO >= 100

#include "Arduino.h"

#else

#include "WProgram.h"

#endif

//--------------------------------------------------------------------------------------
// Sets the pins to be used for voltage and current sensors
//--------------------------------------------------------------------------------------
void EnergyMonitor::voltage(int _inPinV, double _VCAL, double _PHASECAL)
{
   inPinV = _inPinV;
   VCAL = _VCAL;
   PHASECAL = _PHASECAL;
}
 

 

 

Nico2012's picture

Re: Questions about the CT Code

 I've downloaded from a wrong file format and I've realized that I should have copied from a different place. Now it has compiled it and I have to wait till the nigh as I don't have with me the arduino and CT sensor, but at least the sketch is running

Many thank for the help and let's see how it works.

Best regards frm spain

 

Nicolas

 

davek's picture

Re: Questions about the CT Code

Hi I have this exact same problem but I cannot get rid of the errors?

I have used Notepad++ to change between ANSI, UTF-8 etc

, this changes some of the errors lines but still 100's of error lines.

 

I have downloaded the latest versions from https://github.com/openenergymonitor/EmonLib

​using Arduino 1.0.5-r2

HW is Arduino UNO with emonTX Shield V2

sketch is a basic one but have tried a few.

Cheers

Dave

============================================

 

#include <EmonLib.h>

// EmonLibrary examples openenergymonitor.org, Licence GNU GPL V3

EnergyMonitor emon1;             // Create an instance

void setup()

  Serial.begin(9600);
 
  emon1.voltage(2, 234.26, 1.7);  // Voltage: input pin, calibration, phase_shift
  emon1.current(1, 111.1);       // Current: input pin, calibration.
}

void loop()
{
  emon1.calcVI(20,2000);         // Calculate all. No.of half wavelengths (crossings), time-out
  emon1.serialprint();           // Print out all variables (realpower, apparent power, Vrms, Irms, power factor)
 
  float realPower       = emon1.realPower;        //extract Real Power into variable
  float apparentPower   = emon1.apparentPower;    //extract Apparent Power into variable
  float powerFActor     = emon1.powerFactor;      //extract Power Factor into Variable
  float supplyVoltage   = emon1.Vrms;             //extract Vrms into Variable
  float Irms            = emon1.Irms;             //extract Irms into Variable
}

 

 

============================================

 

 

 

In file included from sketch_volt.ino:1:
C:\Users\Dave\Documents\Arduino\libraries\EmonLib/EmonLib.h:1: error: stray '\357' in program
C:\Users\Dave\Documents\Arduino\libraries\EmonLib/EmonLib.h:1: error: stray '\273' in program
C:\Users\Dave\Documents\Arduino\libraries\EmonLib/EmonLib.h:1: error: stray '\277' in program
C:\Users\Dave\Documents\Arduino\libraries\EmonLib/EmonLib.h:13: error: stray '\302' in program
C:\Users\Dave\Documents\Arduino\libraries\EmonLib/EmonLib.h:13: error: stray '\267' in program
C:\Users\Dave\Documents\Arduino\libraries\EmonLib/EmonLib.h:13: error: stray '\302' in program
C:\Users\Dave\Documents\Arduino\libraries\EmonLib/EmonLib.h:13: error: stray '\267' in program
In file included from sketch_volt.ino:1:
C:\Users\Dave\Documents\Arduino\libraries\EmonLib/EmonLib.h:282:46: error: invalid suffix "f89d97d88f243ae907d6ae5" on floating constant
C:\Users\Dave\Documents\Arduino\libraries\EmonLib/EmonLib.h:472: error: stray '#' in program
C:\Users\Dave\Documents\Arduino\libraries\EmonLib/EmonLib.h:476: error: stray '#' in program
C:\Users\Dave\Documents\Arduino\libraries\EmonLib/EmonLib.h:485: error: stray '#' in program
C:\Users\Dave\Documents\Arduino\libraries\EmonLib/EmonLib.h:494: error: stray '#' in program
C:\Users\Dave\Documents\Arduino\libraries\EmonLib/EmonLib.h:503: error: stray '#' in program
C:\Users\Dave\Documents\Arduino\libraries\EmonLib/EmonLib.h:512: error: stray '#' in program
C:\Users\Dave\Documents\Arduino\libraries\EmonLib/EmonLib.h:521: error: stray '#' in program
C:\Users\Dave\Documents\Arduino\libraries\EmonLib/EmonLib.h:546: error: stray '#' in program
C:\Users\Dave\Documents\Arduino\libraries\EmonLib/EmonLib.h:550: error: stray '#' in program
C:\Users\Dave\Documents\Arduino\libraries\EmonLib/EmonLib.h:554: error: stray '#' in program
C:\Users\Dave\Documents\Arduino\libraries\EmonLib/EmonLib.h:558: error: stray '#' in program
C:\Users\Dave\Documents\Arduino\libraries\EmonLib/EmonLib.h:562: error: stray '#' in program
C:\Users\Dave\Documents\Arduino\libraries\EmonLib/EmonLib.h:571: error: stray '#' in program
C:\Users\Dave\Documents\Arduino\libraries\EmonLib/EmonLib.h:816: error: stray '#' in program
C:\Users\Dave\Documents\Arduino\libraries\EmonLib/EmonLib.h:5: error: expected unqualified-id before '<' token
C:\Users\Dave\Documents\Arduino\libraries\EmonLib/EmonLib.h:485: error: expected constructor, destructor, or type conversion before ';' token
C:\Users\Dave\Documents\Arduino\libraries\EmonLib/EmonLib.h:485: error: expected unqualified-id before numeric constant
C:\Users\Dave\Documents\Arduino\libraries\EmonLib/EmonLib.h:485: error: expected unqualified-id before '=' token
C:\Users\Dave\Documents\Arduino\libraries\EmonLib/EmonLib.h:494: error: expected constructor, destructor, or type conversion before '.' token
C:\Users\Dave\Documents\Arduino\libraries\EmonLib/EmonLib.h:494: error: expected unqualified-id before '<' token
C:\Users\Dave\Documents\Arduino\libraries\EmonLib/EmonLib.h:512: error: expected constructor, destructor, or type conversion before '.' token
C:\Users\Dave\Documents\Arduino\libraries\EmonLib/EmonLib.h:512: error: expected unqualified-id before '<' token
C:\Users\Dave\Documents\Arduino\libraries\EmonLib/EmonLib.h:571: error: expected constructor, destructor, or type conversion before ';' token
C:\Users\Dave\Documents\Arduino\libraries\EmonLib/EmonLib.h:571: error: expected constructor, destructor, or type conversion before ')' token
C:\Users\Dave\Documents\Arduino\libraries\EmonLib/EmonLib.h:807: error: expected unqualified-id before '<' token
C:\Users\Dave\Documents\Arduino\libraries\EmonLib/EmonLib.h:860: error: expected unqualified-id before numeric constant
In file included from C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/Arduino.h:4,
                 from sketch_volt.ino:5:
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:143: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:144: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:175: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:175: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:290: error: 'size_t' was not declared in this scope
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:302: error: 'size_t' does not name a type
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:319: error: 'size_t' was not declared in this scope
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:319: error: 'size_t' was not declared in this scope
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:319: error: initializer expression list treated as compound expression
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:338: error: 'size_t' has not been declared
In file included from C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/Arduino.h:5,
                 from sketch_volt.ino:5:
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/string.h:113: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/string.h:114: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/string.h:115: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/string.h:116: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/string.h:117: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/string.h:117: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/string.h:118: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/string.h:119: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/string.h:120: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/string.h:128: error: 'size_t' does not name a type
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/string.h:130: error: 'size_t' does not name a type
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/string.h:131: error: 'size_t' does not name a type
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/string.h:132: error: 'size_t' does not name a type
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/string.h:134: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/string.h:135: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/string.h:136: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/string.h:137: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/string.h:138: error: 'size_t' does not name a type

Robert Wall's picture

Re: Questions about the CT Code

Did you by any chance copy the web page from Github and not the RAW version? If you don't use Git as intended (I don't), you need to go to the raw version using your web browser - the button top right corner of the file window, then save the file from there. My emonlib.h file is 90 lines, the web page is nearly 900 lines long and as you have line numbers in the 800's, that seems a possibility.

davek's picture

Re: Questions about the CT Code

Ah, That could be the problem, Ill re try tonight.

Thanks for the quick response!

 

Cheers

Dave

davek's picture

Re: Questions about the CT Code

Thanks, All good, EmonLib now loading with no error's.

I have Shield_CT1234_Voltage_SerialOnly.ino working and displaying values via Serial Monitor.

I have problems with Shield_CT1234_Voltage throwing up errors.  Fixed many before this by sorting JeeLib/Ports and other libraries but stumped here.

From "Shield_CT1234_Voltage"

#define RF_freq RF12_433MHZ  

the value of RF_freq is the default in the code set as RF12_433MHZ which aligns with the hardware I have.

 

Errors;

Shield_CT1234_Voltage.ino: In function 'void setup()':

Shield_CT1234_Voltage:77: error: 'RF12_433MHZ' was not declared in this scope

Shield_CT1234_Voltage:78: error: 'RF12_433MHZ' was not declared in this scope
Shield_CT1234_Voltage:78: error: 'RF12_868MHZ' was not declared in this scope
Shield_CT1234_Voltage:79: error: 'RF12_433MHZ' was not declared in this scope
Shield_CT1234_Voltage:79: error: 'RF12_915MHZ' was not declared in this scope
Shield_CT1234_Voltage:94: error: 'RF12_433MHZ' was not declared in this scope
Shield_CT1234_Voltage:94: error: 'rf12_initialize' was not declared in this scope
Shield_CT1234_Voltage:95: error: 'RF12_SLEEP' was not declared in this scope
Shield_CT1234_Voltage:95: error: 'rf12_sleep' was not declared in this scope
Shield_CT1234_Voltage.ino: In function 'void loop()':
Shield_CT1234_Voltage:140: error: 'send_rf_data' was not declared in this scope

Any idea's?

 

Cheers

Dave

 

Robert Wall's picture

Re: Questions about the CT Code

If you look at the comments at the top of the sketch, do you see something about "THIS SKETCH REQUIRES"? Have you downloaded and installed all those libraries into the correct place (and read the notes that come with them - some libraries require renaming as part of the installation process)? All the instructions are included with "Setting Up Arduino IDE"

The "serial only" sketch does not use the RFM12 library calls, which is why it works without the JeeLib library.

davek's picture

Re: Questions about the CT Code

Thank you , all good now.

I had individually downloaded the JeeLib files I needed and had them in individual library directories.

First I combined them initially, got different errors deeper in the dependencies, figured out I could get the whole lot as a zip, problem solved.

all compiling now with no errors.

 

Cheers

Dave

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.