Send Tweet with the CC3000 sketch question

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
briank2
 
Posts: 3
Joined: Thu Mar 14, 2013 12:26 am

Send Tweet with the CC3000 sketch question

Post by briank2 »

I am trying to combine two sketches.

The first is the "send tweet" sketch, the second is a thermistor sketch. The thermistor sketch calculates different values on A0 and then converts the value to a temp. What I would like to do, but am not sure how, is have the temperature value from the Thermistor part of the sketch go out as a Tweet using the CC3000 board.

this is the part of the "send tweet" example sketch that I would like to input my temperature reading and send out as a tweet.

Code: Select all

void loop() {

  unsigned long t = millis();

  // For now this just issues a fixed tweet.  In reality, you might want to
  // read from some sensors or that sort of thing, then nicely format the
  // results into a buffer to be passed to the sendTweet() function.
  sendTweet("Adafruit IoTa test. Tweet directly from Arduino...no proxy, no wires! http://www.adafruit.com/products/1469");
What do I need to do to change the fixed message to a fixed message with a sensor reading? Nicely formatting the results into a buffer sounds great, but I have no idea how to do that. :D

so instead of sendTweet("Adafruit IoTa test. Tweet directly from Arduino...no proxy, no wires! http://www.adafruit.com/products/1469");
I would like it to say something like sendTweet("the temp is (temp reading));

has anyone played around with getting tweets to go out showing sensor readings and want to share?

User avatar
neslekkim
 
Posts: 61
Joined: Tue Apr 24, 2012 4:20 am

Re: Send Tweet with the CC3000 sketch question

Post by neslekkim »


User avatar
briank2
 
Posts: 3
Joined: Thu Mar 14, 2013 12:26 am

Re: Send Tweet with the CC3000 sketch question

Post by briank2 »

Thanks for the link,

Time for a little reading.

User avatar
briank2
 
Posts: 3
Joined: Thu Mar 14, 2013 12:26 am

Re: Send Tweet with the CC3000 sketch question

Post by briank2 »

Alright started looking at the link
and added a constant string to the "send tweet" example sketch in the adafruit_CC3000 library
void loop() {

Code: Select all

void loop() {
   // using a constant String:
   String stringOne = "Hello String";     
   Serial.println(stringOne);      // prints "Hello String"
I added it here:

Code: Select all

void loop() {
  
  String stringOne = "Hello String";  

  unsigned long t = millis();

  // For now this just issues a fixed tweet.  In reality, you might want to
  // read from some sensors or that sort of thing, then nicely format the
  // results into a buffer to be passed to the sendTweet() function.
  sendTweet (stringOne);
when I verify the change I get and error
cannot convert 'Sting' to 'char*' for arguent '1' to 'Boolean sendTweet(char*)'

So I started looking at the error and that brought me to this part of the sketch

Code: Select all

// Returns true on success, false on error
boolean sendTweet(char *msg) { // 140 chars max! No checks made here.
  uint8_t                  *in, out, i;
  char                      nonce[9],       // 8 random digits + NUL
                            searchTime[11], // 32-bit int + NUL
                            b64[29];
  unsigned long             startTime, t, ip;
  static const char PROGMEM b64chars[] =
    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
I believe my problem may be with the sendTweet(char *msg)
I doing some web searching I came across this link where it looks like another person was trying to figure this out... http://forum.arduino.cc/index.php?topic=48530.0
at the end of it there was a suggestion about using:
itoa()
not sure if this is going anywhere or not, but wanted to update where I am at with this

Locked
Please be positive and constructive with your questions and comments.

Return to “Microcontrollers”