I am currently trying to get a sample sketch to work, which comes with the Twitter library by Markku Rossi (for which see: arduino/libraries/Twitter at master · markkurossi/arduino · GitHub), but I am encountering the following error:
no matching function for call to 'Twitter::set_twitter_endpoint(const char*, const char*, IPAddress&, uint16_t&, bool)'
I have been searching around for leads that might help me to understand what causes this error and how it can be solved, but I am out of ideas.
For the sketch I am trying to run, see below. Any ideas that would get me going are warmly welcomed.
/* -*- c++ -*-
*
* Twitter.pde
*
* Author: Markku Rossi <mtr@iki.fi>
*
* Copyright (c) 2011-2012 Markku Rossi
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
#include <SPI.h>
#include <Ethernet.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <sha1.h>
#include <Time.h>
#include <EEPROM.h>
#include <Twitter.h>
/* OneWire bus pin. */
const int busPin = 2;
OneWire bus(busPin);
DallasTemperature sensors(&bus);
DeviceAddress sensor1;
DeviceAddress sensor2;
byte mac[] =
{
0x99, 0x99, 0x99, 0x99, 0x99, 0x99 // dummy MAC-adres Arduino
};
IPAddress timeServer(999, 999, 999, 9); // dummy IP-address of Fritz!Box acting as NTP-server
IPAddress ip(999, 999, 999, 99); // IP-adres of Arduino
/* The IP address to connect to: Twitter or local HTTP proxy. */
IPAddress twitter_ip(199, 59, 149, 232);
uint16_t twitter_port = 80;
unsigned long last_tweet = 0;
#define TWEET_DELTA (60L * 60L)
/* Work buffer for twitter client. This should be fine for normal
operations, the biggest items that are stored into the working
buffer are URL encoded consumer and token secrets and HTTP response
header lines. */
char buffer[512];
const static char consumer_key[] PROGMEM = "XXX"; // dummy Consumer Key
const static char consumer_secret[] PROGMEM = "XXX"; // dummy Consumer Secret Key
Twitter twitter(buffer, sizeof(buffer));
void
setup()
{
Serial.begin(9600);
Serial.println("Arduino Twitter demo");
sensors.begin();
if (!sensors.getAddress(sensor1, 0))
{
Serial.println("DS18B20 NUMBER 1 NOT FOUND!");
}
if (!sensors.getAddress(sensor2, 1))
{
Serial.println("DS18B20 NUMBER 2 NOT FOUND!");
}
Ethernet.begin(mac, ip);
twitter.set_twitter_endpoint(PSTR("api.twitter.com"),
PSTR("/1/statuses/update.json"),
twitter_ip, twitter_port, false);
twitter.set_client_id(consumer_key, consumer_secret);
#if 1
/* Read OAuth account identification from EEPROM. */
twitter.set_account_id(256, 384);
#else
/* Set OAuth account identification from program memory. */
Twitter.set_account_id(PSTR("XXX"), // dummy key value
PSTR("XXX")); // dummy key value
#endif
delay(500);
}
void
loop()
{
if (twitter.is_ready())
{
unsigned long now = twitter.get_time();
if (last_tweet == 0)
{
/* First round after twitter initialization. */
Serial.print("Time is ");
Serial.println(now);
/* Wait few seconds before making our first tweet. This
gives our sensors some time to get running (I hope). */
last_tweet = now - TWEET_DELTA + 15L;
}
sensors.requestTemperatures();
float temp = sensors.getTempCByIndex(0);
Serial.println(temp);
if (temp != DEVICE_DISCONNECTED && now > last_tweet + TWEET_DELTA)
{
char msg[32];
long val = temp * 100L;
sprintf(msg, "Office temperature is %ld.%02ld\302\260C",
val / 100L, val % 100L);
Serial.print("Posting to Twitter: ");
Serial.println(msg);
last_tweet = now;
if (twitter.post_status(msg))
Serial.println("Status updated");
else
Serial.println("Update failed");
}
}
delay(5000);
}