Hello Arduino Forum,
I am trying to create a sketch that tweets 29 different tweets in secession and then starts from the beginning again and keeps doing this. I took Temboo's statusupdate_sketch example and modified it a bit so it looked like this:
#include <Bridge.h>
#include <Temboo.h>
#include "TembooAccount.h" // contains Temboo account information, as described below
int quoteCounter = 1; // Execution count, so this doesn't run forever
int maxRuns = 26; // Maximum number of times the Choreo should be executed
#define tweet1 "1949 - Mao becomes Chairman"
#define tweet2 "1949 - Mao convinces Stalin to sign a treaty for economic aid"
#define tweet3 "1956 - Mao encourages 'a hundred flowers to bloom', telling intellectuals to speak out"
#define tweet4 "Mao then targeted the intellectuals who spoke out for improvement"
#define tweet5 "1958 - Mao launches Great Leap Forward"
#define tweet6 "He encouraged people to set up 'people's communes' - dissolving private property"
#define tweet7 "People did not have resources or administration to manage such large social units"
#define tweet8 "In an effort to please Mao party officials left very little grain for people, most of it sent to the government"
#define tweet9 "'Backyard steel' created in an attempt to rapidly industrialize China was useless and consumed resources."
#define tweet10 "30 million starved"
#define tweet11 "1959 - Mao realises change is needed."
#define tweet12 "1966 - The Great Proletariat Cultural Revolution is begun"
#define tweet14 "Called for students to become 'Red Guards', a group of Mao followers dedicated to his idea for China"
#define tweet15 "Red Guards rampaged through cities to destroy Four Olds 四舊"
#define tweet16 "Four Olds - Old Customs, Old Culture, Old Habits, and Old Ideas"
#define tweet17 "Red Guards attacked and humiliated people from 'bad class status' - intellectuals or wealthy"
#define tweet18 "Private property was invaded by Red Guards and trashed"
#define tweet19 "This created great chaos, violence, injury and death #unsuccessful"
#define tweet20 "1966 - Mao Zhuxi Yulu, often known as the #Little_Red_Book, was published"
#define tweet21 "Mao’s quotes were the unchallenged rules the by which Chinese lived"
#define tweet22 ""
#define tweet23 "August 1966 - Culture - Lao She, a famous playwright is beaten to death by Red Guards"
#define tweet24 "Culture - All art supposed to be #propaganda for Mao"
#define tweet25 "1972 - Nixon Visits China"
#define tweet26 "Despite differences Mao can negotiate with US to China’s advantage"
#define tweet27 "US agrees to aid China if Taiwan tries to take power"
#define tweet28 "US used to support Taiwan, Mao made China a more valuable ally"
#define tweet29 "The end result: 1.5 million murdered, a million more tortured, imprisoned, humiliated or robbed of property."
void setup() {
Serial.begin(9600);
// For debugging, wait until the serial console is connected.
delay(4000);
while(!Serial);
Bridge.begin();
}
void loop() {
String tweets[] = {tweet1, tweet2, tweet3, tweet4, tweet5, tweet6, tweet7, tweet8, tweet9, tweet10, tweet11, tweet12, tweet14, tweet15, tweet16, tweet17, tweet18, tweet19, tweet20, tweet21, tweet22, tweet23, tweet24, tweet26};
if (quoteCounter <= maxRuns) {
Serial.println("Running StatusesUpdate - Run #" + String(quoteCounter));
TembooChoreo StatusesUpdateChoreo;
// Invoke the Temboo client
StatusesUpdateChoreo.begin();
// Set Temboo account credentials
StatusesUpdateChoreo.setAccountName(TEMBOO_ACCOUNT);
StatusesUpdateChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME);
StatusesUpdateChoreo.setAppKey(TEMBOO_APP_KEY);
// Set Choreo inputs
StatusesUpdateChoreo.addInput("AccessToken", ACCESS_TOKEN);
StatusesUpdateChoreo.addInput(ACESS_TOKEN_SECRET);
StatusesUpdateChoreo.addInput(CONSUMER_SECRET);
StatusesUpdateChoreo.addInput("StatusUpdate", tweets[quoteCounter]); //tweet the tweet
StatusesUpdateChoreo.addInput("ConsumerKey", CONSUMER_KEY);
// Identify the Choreo to run
StatusesUpdateChoreo.setChoreo("/Library/Twitter/Tweets/StatusesUpdate");
// Run the Choreo; when results are available, print them to serial
StatusesUpdateChoreo.run();
while(StatusesUpdateChoreo.available()) {
char c = StatusesUpdateChoreo.read();
Serial.print(c);
}
StatusesUpdateChoreo.close();
quoteCounter++;
}
Serial.println("Waiting...");
delay(30000); // wait 30 seconds between StatusesUpdate calls
}
WHAT IS GOING ON? In the Temboo example the Serial Monitor says "Running StatusesUpdate...." but in this nothing happens. PLEASE RESPOND QUICKLY!