Go Down

Topic: esp8266 Arduino IDE compiler problem with temboo library (Read 9400 times) previous topic - next topic

cliffArduino

I have been very happily programming $5 esp8266 esp-12 chips with the Arduino IDE but am at an impasse in trying to use the temboo library.

i'm attempting to compile sample code included with the IDE at: "Arduino\libraries\Bridge\examples\Temboo\SendDataToGoogleSpreadsheet"

when the IDE is set to board type "Generic ESP 8266" or "Uno", I get a compiler error: "no matching function for call to 'TembooChoreo::TembooChoreo()'"

when the board type is set to "Arduino Yun" the code compiles without errors.

there is some control logic in the temboo.h file that seems to selecting certain parameters based on board type. This might be the problem but i'm not enough of a programmer to figure this out.

any help on this would be appreciated!

- Cliff

Hackscribble

Hi Cliff

The libraries under Bridge are intended for the Yun and the Tre only.

This page on the Temboo website talks about writing programs for other Arduino boards with the ethernet shield - it is for the example you mentioned with Google spreadsheets.

https://temboo.com/arduino/others/update-google-spreadsheet

It sounds like you configure stuff on Temboo and then it generates a skeleton Arduino program to download.  If you can do that and post the program, it should be possible to modify it to work with the ESP8266 wifi stack rather than the Arduino ethernet shield.

Regards

Ray
Hackscribble.  Writing about making things.
arduino@hackscribble.com | www.hackscribble.com

cliffArduino

thanks Ray -

I tried this tack, made some progress and ran into a different build issue :-(

I ran the automated code creation script on temboo and it output the code below. I modified the include statements so ESP8266WiFi.h replaces WiFi.h.

now I get a different build error: "C:\Program Files (x86)\Arduino\libraries\Temboo\src\Temboo.cpp:89:26: fatal error: avr/pgmspace.h: No such file or directory
 #include <avr/pgmspace.h>"

i verified that the pgmspace header file does actually exist. I also tried compiling this code with board type set to "Uno" and the regular WiFi library commented back in and it does not complain of (at least this issue) during build. so... i think there is a specific compatibility issue with the ESP8266WiFi library.

here is the code - could someone out there skilled in debugging build errors take a look?

Code: [Select]
/* Setup shield-specific #include statements */
#include <SPI.h>
//#include <WiFi.h>
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <Temboo.h>
//#include "TembooAccount.h" // Contains Temboo account information

/*
IMPORTANT NOTE about TembooAccount.h

TembooAccount.h contains your Temboo account information and must be included
alongside your sketch. To do so, make a new tab in Arduino, call it TembooAccount.h,
and copy this content into it.
*/

#define TEMBOO_ACCOUNT "sdfasdf"  // Your Temboo account name
#define TEMBOO_APP_KEY_NAME "sdfsdfsda"  // Your Temboo app key name
#define TEMBOO_APP_KEY "sdfasdfsdfdsf"  // Your Temboo app key

#define WIFI_SSID "mySSID"
#define WPA_PASSWORD "wifipasswd"

/*
The same TembooAccount.h file settings can be used for all Temboo SDK sketches. 
Keeping your account information in a separate file means you can share the
main .ino file without worrying that you forgot to delete your credentials.
*/

WiFiClient client;

// The number of times to trigger the action if the condition is met
// We limit this so you won't use all of your Temboo calls while testing
int maxCalls = 10;

// The number of times this Choreo has been run so far in this sketch
int calls = 0;
int outputPin = 6;
int inputPin = A0;


void setup() {
  Serial.begin(9600);
 
  // For debugging, wait until the serial console is connected
  delay(4000);
  while(!Serial);

  int wifiStatus = WL_IDLE_STATUS;

  // Determine if the WiFi Shield is present
  Serial.print("\n\nShield:");
  if (WiFi.status() == WL_NO_SHIELD) {
    Serial.println("FAIL");

    // If there's no WiFi shield, stop here
    while(true);
  }

  Serial.println("OK");

  // Try to connect to the local WiFi network
  while(wifiStatus != WL_CONNECTED) {
    Serial.print("WiFi:");
    wifiStatus = WiFi.begin(WIFI_SSID, WPA_PASSWORD);

    if (wifiStatus == WL_CONNECTED) {
      Serial.println("OK");
    } else {
      Serial.println("FAIL");
    }
    delay(5000);
  }

  // Initialize pins
  pinMode(outputPin, OUTPUT);
  pinMode(inputPin, INPUT);

  Serial.println("Setup complete.\n");
}

void loop() {
  int sensorValue = analogRead(inputPin);
  Serial.println("Sensor: " + String(sensorValue));

  if (sensorValue == 0) {
    if (calls < maxCalls) {
      Serial.println("\nTriggered! Calling AppendRow Choreo...");
      runAppendRow(sensorValue);
      calls++;
    } else {
      Serial.println("\nTriggered! Skipping to save Temboo calls. Adjust maxCalls as required.");
    }
  }

  delay(250);
}

void runAppendRow(int sensorValue) {
  TembooChoreo AppendRowChoreo(client);

  // Set Temboo account credentials
  AppendRowChoreo.setAccountName(TEMBOO_ACCOUNT);
  AppendRowChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME);
  AppendRowChoreo.setAppKey(TEMBOO_APP_KEY);

  // Set profile to use for execution
  AppendRowChoreo.setProfile("test1");
  // Identify the Choreo to run
  AppendRowChoreo.setChoreo("/Library/Google/Spreadsheets/AppendRow");

  // Run the Choreo
  unsigned int returnCode = AppendRowChoreo.run();

  // A return code of zero means everything worked
  if (returnCode == 0) {
    while (AppendRowChoreo.available()) {
      String name = AppendRowChoreo.readStringUntil('\x1F');
      name.trim();

      String data = AppendRowChoreo.readStringUntil('\x1E');
      data.trim();

      if (name == "NewAccessToken") {
        if (data == "") {
          digitalWrite(outputPin, HIGH);
        }
      }
    }
  }

  AppendRowChoreo.close();
}

Hackscribble

The ESP8266 Arduino core probably uses a different version of pgmspace.h, which won't be in that "avr/" sub folder, which relates to the standard Arduino core.

The fix may be as simple as changing "avr/pgmspace.h" to "pgmspace.h" in the Temboo library file identified in the error message. But that's a kludge, since it is changing a core Arduino library.
Hackscribble.  Writing about making things.
arduino@hackscribble.com | www.hackscribble.com

cliffArduino

well, i'm happy to say that this worked !

the fix is to go to the Arduino\libraries\Temboo\src\utility directory and modify the following files to say "pgmspace.h" rather than "avr/pgmspace.h":
ChoreoInputFormatter
ChoreoOutputFormatter
ChoreoPresetFormatter
TembooSession
tmbhmac
tmbmd5


this is not an ideal situation but i'm happy with the kludge. Now logging sensor data to a google spreadsheet.

thanks Ray !

cliffArduino

here is the final working code...

this includes instructions for modifying the temboo libraries
Code: [Select]
/* demonstration program appending rows to a google sheet by pushing data from an esp8266 via Temboo
- original code acquired from: https://temboo.com/arduino/others/update-google-spreadsheet and modified
C Smith  23-Jul-2015

IMPORTANT
this compiled and ran successfully under Arduino 1.6.4 but only after modifying the following Temboo library files:
C:\Program Files (x86)\Arduino\libraries\Temboo\src\Temboo.cpp
C:\Program Files (x86)\Arduino\libraries\Temboo\src\utility\
----ChoreoInputFormatter
----ChoreoOutputFormatter
----ChoreoPresetFormatter
----TembooSession
----tmbhmac
----tmbmd5
... all occurances of "avr/pgmspace.h" in these files needs to be changed to "pgmspace.h"

also: this demo code appends a spreadsheet row with three cells, so there must be a minimum of
three spreadsheet headings in the 1st row in cells a1, b1 & c1

also: in my testing AppendRowChoreo.run() sometimes times out and returns a non-zero return code. logic needs to be
added to re-try if this happens
*/

#include <SPI.h>
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <Temboo.h>        // the temboo libraries require modification - see note above

#include "MyCommonDefinitions.h"
/* MyCommonDefinitions.h has definitions:
#define WIFI_SSID_1     "mySSID1"
#define WIFI_PASSWORD_1 "wifipassword1"
#define WIFI_SSID_2     "mySSID2"
#define WIFI_PASSWORD_2 "wifipassword2"
*/

#include "TembooAccount.h" // Contains Temboo account information
/* TembooAccount.h has definitions:
#define TEMBOO_ACCOUNT      "dsfasdfsdf"         //  Temboo account name
#define TEMBOO_APP_KEY_NAME "myFirstApp"         //  Temboo app key name
#define TEMBOO_APP_KEY      "sdfasdfsadfasdfsf"  //  Temboo app key
*/

WiFiClient client;

// The number of times to trigger the action if the condition is met
// We limit this so you won't use all of your Temboo calls while testing
int maxCalls = 4;
int calls = 0;  // The number of times this Choreo has been run so far in this sketch

void setup() {
  Serial.begin(115200);
  delay(4000);  // buy time for a human to open the serial window

  Serial.println("start of temboo test");

  // Try to connect to the local WiFi network
  WiFi.begin(WIFI_SSID_1, WIFI_PASSWORD_1);
  while (WiFi.status() != WL_CONNECTED) {                     // wait for the loging process to complete
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.print("WiFi connected - IP address of ESP8266 is:");
  Serial.println(WiFi.localIP());
  delay(3000);  // let the dust settle
}

void loop() {
  int sensorValue = (calls + 1) * 10;                  // fake a sensor reading
  Serial.println("Sensor: " + String(sensorValue));

  if (calls < maxCalls) {
    runAppendRow(sensorValue);
    calls++;
  } else {
    Serial.println("maxCalls exceeded - no further calls to temboo");
  }
  delay(4000);
}

void runAppendRow(int sensorValue) {
  Serial.println("+++++start of runAppendRow");
  TembooChoreo AppendRowChoreo(client);

  // Set Temboo account credentials
  Serial.println("set Temboo account credentials");
  AppendRowChoreo.setAccountName(TEMBOO_ACCOUNT);
  AppendRowChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME);
  AppendRowChoreo.setAppKey(TEMBOO_APP_KEY);

  // Set profile to use for execution
  AppendRowChoreo.setProfile("test1");
  // Identify the Choreo to run
  Serial.println("identify the Choreo to run");
  AppendRowChoreo.setChoreo("/Library/Google/Spreadsheets/AppendRow");

  String rowData = "12-JAN-2006," + String(sensorValue) + ",this is the text";
  Serial.println("rowData =" + rowData);

  //AppendRowChoreo.addInput("RowData", "00-MMM-1922," + String(sensorValue) + ",this is the text");
  AppendRowChoreo.addInput("RowData", rowData);

  // Run the Choreo
  Serial.print("run the Choreo - return code =");
  unsigned int returnCode = AppendRowChoreo.run();
  Serial.println(returnCode);

  // A return code of zero means everything worked
  if (returnCode == 0) {
    // this commented-out code crashes the ESP8266 for some reason
    //while (AppendRowChoreo.available()) {
    //  Serial.println("read the return string");
    //  char c = AppendRowChoreo.read();
    //  Serial.print(c);
    //}
    Serial.println("close AppendRowChoreo");
    AppendRowChoreo.close();
  }
  Serial.println("-----end of runAppendRow");
}

turksami3

Hi, I have other problem about Temboo Read A tweet When i want to read with this function
" char c = HomeTimelineChoreo.read();  "  It gives me this error " Exception (3):
epc1=0x40202d8a ....." Also I try and delete this function every things okey. But i cannot reads a tweets.

Code: [Select]

#include "TembooAccount.h" // Contains Temboo account information
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <Temboo.h>        // the temboo libraries require modification - see note above
#define WIFI_SSID_1     "ssid"
#define WIFI_PASSWORD_1 "pass"
WiFiClient client;



 

int numRuns = 1;   // Execution count, so this doesn't run forever
int maxRuns = 10;   // Maximum number of times the Choreo should be executed

void setup() {
 Serial.begin(115200);
  delay(4000);  // buy time for a human to open the serial window

  Serial.println("start of temboo test");

  // Try to connect to the local WiFi network
  WiFi.begin(WIFI_SSID_1, WIFI_PASSWORD_1);
  while (WiFi.status() != WL_CONNECTED) {                     // wait for the loging process to complete
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.print("WiFi connected - IP address of ESP8266 is:");
  Serial.println(WiFi.localIP());
  delay(3000);  // let the dust settle
}

void loop() {
  if (numRuns <= maxRuns) {

    Serial.println("Running HomeTimeline - Run #" + String(numRuns++));

    TembooChoreo HomeTimelineChoreo(client);
Serial.println("42");
    // Invoke the Temboo client
    HomeTimelineChoreo.begin();
Serial.println("45");
    // Set Temboo account credentials
    HomeTimelineChoreo.setAccountName(TEMBOO_ACCOUNT);
    Serial.println("48");
    HomeTimelineChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME);
    Serial.println("50");
    HomeTimelineChoreo.setAppKey(TEMBOO_APP_KEY);
Serial.println("52");
    // Set Choreo inputs
    String AccessTokenValue = "asdaadsdada";
    HomeTimelineChoreo.addInput("AccessToken", AccessTokenValue);
    Serial.println("56");
    String ConsumerKeyValue = "asdasdadal";
    HomeTimelineChoreo.addInput("ConsumerKey", ConsumerKeyValue);
    String ConsumerSecretValue = "asdasdasda";
    HomeTimelineChoreo.addInput("ConsumerSecret", ConsumerSecretValue);
    Serial.println("61");
    String AccessTokenSecretValue = "asdasdasdasdasd";
    HomeTimelineChoreo.addInput("AccessTokenSecret", AccessTokenSecretValue);

    // Identify the Choreo to run
    HomeTimelineChoreo.setChoreo("/Library/Twitter/Timelines/HomeTimeline");
Serial.println("67");
    // Run the Choreo; when results are available, print them to serial
    HomeTimelineChoreo.run();
Serial.println("70");
    while(HomeTimelineChoreo.available()) {
      Serial.println("72");
      char c = HomeTimelineChoreo.read();        // I GOT PROBLEM HERE
     Serial.print(c);                                         
      Serial.println("75");
    }
    Serial.println("77");
    HomeTimelineChoreo.close();
    Serial.println("79");
  }

  Serial.println("\nWaiting...\n");
  delay(30000); // wait 30 seconds between HomeTimeline calls
}

lgarridoj

turksami3, did you solve this issue?



Hi, I have other problem about Temboo Read A tweet When i want to read with this function
" char c = HomeTimelineChoreo.read();  "  It gives me this error " Exception (3):
epc1=0x40202d8a ....." Also I try and delete this function every things okey. But i cannot reads a tweets.

Code: [Select]

#include "TembooAccount.h" // Contains Temboo account information
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <Temboo.h>        // the temboo libraries require modification - see note above
#define WIFI_SSID_1     "ssid"
#define WIFI_PASSWORD_1 "pass"
WiFiClient client;



 

int numRuns = 1;   // Execution count, so this doesn't run forever
int maxRuns = 10;   // Maximum number of times the Choreo should be executed

void setup() {
 Serial.begin(115200);
  delay(4000);  // buy time for a human to open the serial window

  Serial.println("start of temboo test");

  // Try to connect to the local WiFi network
  WiFi.begin(WIFI_SSID_1, WIFI_PASSWORD_1);
  while (WiFi.status() != WL_CONNECTED) {                     // wait for the loging process to complete
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.print("WiFi connected - IP address of ESP8266 is:");
  Serial.println(WiFi.localIP());
  delay(3000);  // let the dust settle
}

void loop() {
  if (numRuns <= maxRuns) {

    Serial.println("Running HomeTimeline - Run #" + String(numRuns++));

    TembooChoreo HomeTimelineChoreo(client);
Serial.println("42");
    // Invoke the Temboo client
    HomeTimelineChoreo.begin();
Serial.println("45");
    // Set Temboo account credentials
    HomeTimelineChoreo.setAccountName(TEMBOO_ACCOUNT);
    Serial.println("48");
    HomeTimelineChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME);
    Serial.println("50");
    HomeTimelineChoreo.setAppKey(TEMBOO_APP_KEY);
Serial.println("52");
    // Set Choreo inputs
    String AccessTokenValue = "asdaadsdada";
    HomeTimelineChoreo.addInput("AccessToken", AccessTokenValue);
    Serial.println("56");
    String ConsumerKeyValue = "asdasdadal";
    HomeTimelineChoreo.addInput("ConsumerKey", ConsumerKeyValue);
    String ConsumerSecretValue = "asdasdasda";
    HomeTimelineChoreo.addInput("ConsumerSecret", ConsumerSecretValue);
    Serial.println("61");
    String AccessTokenSecretValue = "asdasdasdasdasd";
    HomeTimelineChoreo.addInput("AccessTokenSecret", AccessTokenSecretValue);

    // Identify the Choreo to run
    HomeTimelineChoreo.setChoreo("/Library/Twitter/Timelines/HomeTimeline");
Serial.println("67");
    // Run the Choreo; when results are available, print them to serial
    HomeTimelineChoreo.run();
Serial.println("70");
    while(HomeTimelineChoreo.available()) {
      Serial.println("72");
      char c = HomeTimelineChoreo.read();        // I GOT PROBLEM HERE
     Serial.print(c);                                         
      Serial.println("75");
    }
    Serial.println("77");
    HomeTimelineChoreo.close();
    Serial.println("79");
  }

  Serial.println("\nWaiting...\n");
  delay(30000); // wait 30 seconds between HomeTimeline calls
}


I was attempting to use Temboo with a SparkFun esp8266 Dev board and Arduino IDE 1.6.12 and couldn't get my code to compile after making the above modifications to the noted files. I also discovered several additional files that included "pgmspace.h" vs. just the ones mentioned above.

I kept getting an error message related to the bridge.a library, and couldn't resolve the issue.

After a frustrating night of troubleshooting, I was finally able to get my code to compile by downloading this modified Temboo directory and substituting it for mine.

Maybe this will prevent others from the same frustration I endured.

kaleun96

lgarridoj,turksami3 - did either of you guys solve that issue? I'm running into the same problem :(

nicklat

lgarridoj,turksami3 - did either of you guys solve that issue? I'm running into the same problem :(
Guys I have the same problem. It seems to be a bug with the library. If anyone has solved this problem please share it with us. The IOT must become real!

Thanks

PS. This is my first post and I would also like to express how great and helpful this forum is!

uditk14

well, i'm happy to say that this worked !

the fix is to go to the Arduino\libraries\Temboo\src\utility directory and modify the following files to say "pgmspace.h" rather than "avr/pgmspace.h":
ChoreoInputFormatter
ChoreoOutputFormatter
ChoreoPresetFormatter
TembooSession
tmbhmac
tmbmd5


this is not an ideal situation but i'm happy with the kludge. Now logging sensor data to a google spreadsheet.

thanks Ray !
We have to select Arduino Yun board?
Code is compiling after updating the libraries when I select Yun but this code can't be uploaded to UNO?
How to use for UNO+ESP8266

pert

Of course you don't select Arduino Yun board. You're using an Uno, not a Yun.

Use the WiFiEsp library:
https://github.com/bportaluri/WiFiEsp
to create your client object and then pass that object to the Temboo library, as done in the code posted above.

Go Up