TembooChoreo'未在此范围内声明

时间:2014-09-18 18:55:25

标签: twitter arduino temboo

我是Temboo的新用户,我正在尝试使用他们的Choreo与Arduino和Twitter进行交互。当我从Temboo生成代码并尝试在Arduino IDE中验证它时,我得到了这些错误。

UserTimeline_Twitter.ino: In function 'void loop()':
UserTimeline_Twitter:52: error: 'TembooChoreo' was not declared in this scope
UserTimeline_Twitter:52: error: expected `;' before 'MentionsChoreo'
UserTimeline_Twitter:55: error: 'MentionsChoreo' was not declared in this scope

任何人都可以解释为什么我收到此错误?谢谢,

以下是代码示例

 #include <SPI.h>
#include <WiFi.h>
#include <WiFiClient.h>
#include <Temboo.h>
#include "TembooAccount.h" // Contains Temboo account information

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(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);
  }

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

void loop() {
  if (numRuns <= maxRuns) {
    Serial.println("Running Mentions - Run #" + String(numRuns++));

    TembooChoreo MentionsChoreo(client);

    // Invoke the Temboo client
    MentionsChoreo.begin();

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

    // Set profile to use for execution
    MentionsChoreo.setProfile("TwitterAccount");

    // Set Choreo inputs
    String CountValue = "5";
    MentionsChoreo.addInput("Count", CountValue);

    // Identify the Choreo to run
    MentionsChoreo.setChoreo("/Library/Twitter/Timelines/Mentions");

    // Run the Choreo; when results are available, print them to serial
    MentionsChoreo.run();

    while(MentionsChoreo.available()) {
      char c = MentionsChoreo.read();
      Serial.print(c);
    }
    MentionsChoreo.close();
  }

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

1 个答案:

答案 0 :(得分:0)

看起来你没有安装Temboo的Arduino库。较早版本的Arduino IDE(1.0.x)默认情况下不附带Temboo库,因此我建议升级到最新的1.5.x版本。您可以在此处下载Arduino软件:

http://arduino.cc/en/main/software#toc3