Loading...
Pages: [1]   Go Down
Author Topic: HomeEasy Library  (Read 387 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 7
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I'm trying to use the library example on the playground's HomeEasy page.  My code won't compile though - says "'boolean' has not been declared"

What is wrong with my code?? :-/

Code:
#include <HomeEasyTransmitter.h>

HomeEasyTransmitter HomeEasyTransmitter(2);

void setup() {
  
}

void loop() {
HomeEasyTransmitter.setSwitch(true , 2491418, 6);
delay(3000);
HomeEasyTransmitter.setSwitch(false, 2491418, 6);
delay(3000);
}

Logged

0
Offline Offline
Tesla Member
***
Karma: 71
Posts: 6596
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Looking at the example code there suggests adding at the top:
Code:
#include "WProgram.h"
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 7
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey, thanks.  That seems to work.  Can you tell a newb like me why?
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 311
Posts: 35470
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Because boolean is not a native type. There is a typedef statement in WProgram.h that defines the type.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 7
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Really?

http://arduino.cc/en/Reference/BooleanVariables seems to indicate it is native.

I'm not trying to be smart here, just trying to comprehend things........
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thats becuse the arduino add the file WProgram.h automatic as the first setp in building. ( Thats where you fin boolean. )
"The Arduino environment performs a few transformations to your main sketch file (the concatenation of all the tabs in the sketch without extensions) before passing it to the avr-gcc compiler.

First, #include "WProgram.h" is added to the top of your sketch. This header file (found in <ARDUINO>/hardware/cores/<CORE>/) includes all the defintions needed for the standard Arduino core. " from http://arduino.cc/en/Hacking/BuildProcess.
but it does not add this to libraries.

- Joakim
« Last Edit: April 04, 2010, 04:56:38 am by zyruz » Logged

Pages: [1]   Go Up
Print
 
Jump to: