首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >返回的Google工作表响应代码0,仍然无法工作

返回的Google工作表响应代码0,仍然无法工作
EN

Stack Overflow用户
提问于 2022-09-21 18:09:29
回答 1查看 26关注 0票数 0

所以我正试图通过to和Arduino Yun来更新一张gooogle表。我可以在AppendValues站点上运行AppendRow choreo和AppendRow choreo,所有内容都会更新,但是通过arduino .ino运行这些舞蹈不会在google上显示任何更新。不过,我在运行舞蹈时得到了0的返回代码。所以我知道Oauth在工作,google和temboo在说话,所以我的代码一定有问题吗?

我已经在Arduino代码中双重检查了AccountName、密码、AppKey、刷新令牌、客户端机密、客户端id、电子表格id、电子表格名称等。

AppendRow .ino:

代码语言:javascript
复制
// Include required libraries
#include <Bridge.h>
#include <Temboo.h>

// Debug mode ?
boolean debug_mode = true;

void setup() {

  //start serial
  Serial.begin(115200);
  delay(4000);
  while(!Serial);
  
  // Start bridge
  Bridge.begin();
  
  Serial.println("Setup complete. Waiting for sensor input...\n");
}

void loop() {

  Serial.println("\nCalling the /Library/Google/Spreadsheets/AppendRow Choreo...");
  
  // Append data to Google Docs sheet
  runAppendRow();
  
        
  // Repeat every 10 seconds
  delay(10000);
}

// Function to add data to Google Docs
void runAppendRow() {
  TembooChoreo AppendRowChoreo;

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

  // Set Temboo account credentials
  AppendRowChoreo.setAccountName("");
  AppendRowChoreo.setAppKeyName("myFirstApp");
  AppendRowChoreo.setAppKey("");
  
  // Identify the Choreo to run
  AppendRowChoreo.setChoreo("/Library/Google/Spreadsheets/AppendRow");

  // your Google username (usually your email address)
  AppendRowChoreo.addInput("Username", "");

  // your Google account password
  AppendRowChoreo.addInput("Password", "");
  
  // the title of the spreadsheet you want to append to
  AppendRowChoreo.addInput("SpreadsheetTitle", "Yun");
  
  // Format data
  String data = "123,921";

  // Set Choreo inputs
  AppendRowChoreo.addInput("RowData", data);

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

  // A return code of zero means everything worked
  if (returnCode == 0) {
    if (debug_mode == true){
      Serial.println("Completed execution of the /Library/Google/Spreadsheets/AppendRow Choreo.\n");
      Serial.println("Row added: " + data);
    }
  } else {
    // A non-zero return code means there was an error
    // Read and print the error message
    while (AppendRowChoreo.available()) {
      char c = AppendRowChoreo.read();
      if (debug_mode == true){ Serial.print(c); }
    }
    if (debug_mode == true){ Serial.println(); }
  }
  AppendRowChoreo.close();
}

AppendVValues .ino:

代码语言:javascript
复制
#include <Bridge.h>
#include <Temboo.h>

int calls = 1;   // Execution count, so this doesn't run forever
int maxCalls = 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);
  Bridge.begin();
}

void loop() {
  if (calls <= maxCalls) {
    Serial.println("Running AppendValues - Run #" + String(calls++));
    
    TembooChoreo AppendValuesChoreo;

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

    // Set Temboo account credentials
    AppendValuesChoreo.setAccountName("");
    AppendValuesChoreo.setAppKeyName("");
    AppendValuesChoreo.setAppKey("");
    
    // Set Choreo inputs
    AppendValuesChoreo.addInput("RefreshToken", "");
    AppendValuesChoreo.addInput("ClientSecret", "");
    AppendValuesChoreo.addInput("Values", "[[15,49]]");
    AppendValuesChoreo.addInput("ClientID", "");
    AppendValuesChoreo.addInput("SpreadsheetID", "");
    
    // Identify the Choreo to run
    AppendValuesChoreo.setChoreo("/Library/Google/Sheets/AppendValues");
    
    // Run the Choreo; when results are available, print them to serial
    AppendValuesChoreo.run();
    
    while(AppendValuesChoreo.available()) {
      char c = AppendValuesChoreo.read();
      Serial.print(c);
    }
    AppendValuesChoreo.close();
  }

  Serial.println("Waiting...");
  delay(30000); // wait 30 seconds between AppendValues calls
}
EN

回答 1

Stack Overflow用户

发布于 2022-09-25 16:14:18

看起来他们只支持rev1和最初的盾牌。希望他们很快就能更新rev2董事会的服务。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73805217

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档