Skip to content

Commit 67fa859

Browse files
author
Vinod Cherian
committed
Adding support for additional boards. Removing Twitter and ThingTweet references. Bug Fixes
1 parent 9aceb14 commit 67fa859

File tree

4 files changed

+20
-96
lines changed

4 files changed

+20
-96
lines changed

README.md

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@ In the Arduino IDE, choose Sketch/Include Library/Manage Libraries. Click the T
3232
* Arduino MKR1000
3333
* Arduino MKR1010
3434
* Arduino VIDOR 4000
35+
* Arduino R4 Uno
3536
* Arduino GSM 14000
3637
* Arduino Uno WiFi Rev2
3738
* Arduino Yún (Rev1 and Rev2)
39+
* Raspberry Pi Pico (RP2040 and RP2350)
3840
* ESP8266 programming directly (tested with SparkFun ESP8266 Thing - Dev Board and NodeMCU 1.0 module)
3941
* ESP8266 via AT commands
4042
* ESP32 (tested with SparkFun ESP32 Thing)
@@ -286,7 +288,7 @@ int setField (field, value)
286288
HTTP status code of 200 if successful. See Return Codes below for other possible return values.
287289

288290
## setStatus
289-
Set the status of a multi-field update. Use status to provide additonal details when writing a channel update. Additionally, status can be used by the ThingTweet App to send a message to Twitter.
291+
Set the status of a multi-field update. Use status to provide additonal details when writing a channel update.
290292
```
291293
int setStatus (status)
292294
```
@@ -355,25 +357,6 @@ HTTP status code of 200 if successful. See Return Codes below for other possible
355357
### Remarks
356358
Timezones can be set using the timezone hour offset parameter. For example, a timestamp for Eastern Standard Time is: "2017-01-12 13:22:54-05". If no timezone hour offset parameter is used, UTC time is assumed.
357359

358-
## setTwitterTweet
359-
Set the Twitter account and message to use for an update to be tweeted.
360-
```
361-
int setTwitterTweet (twitter, tweet)
362-
```
363-
364-
| Parameter | Type | Description |
365-
|-----------|:-------------|:---------------------------------------------------------------------------------|
366-
| twitter | String | Twitter account name as a String. |
367-
| | const char * | Twitter account name as a character array (zero terminated). |
368-
| tweet | String | Twitter message as a String (UTF-8) limited to 140 character. |
369-
| | const char * | Twitter message as a character array (zero terminated) limited to 140 character. |
370-
371-
### Returns
372-
HTTP status code of 200 if successful. See Return Codes below for other possible return values.
373-
374-
### Remarks
375-
Prior to using this feature, a twitter account must be linked to your ThingSpeak account. To link your twitter account. login to ThingSpeak and go to Apps -> ThingTweet and click Link Twitter Account.
376-
377360
## readStringField
378361
Read the latest string from a channel. Include the readAPIKey to read a private channel.
379362
```

library.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name=ThingSpeak
2-
version=2.0.0
2+
version=2.1.0
33
author=MathWorks <[email protected]>
44
maintainer=MathWorks <[email protected]>
55
sentence=ThingSpeak Communication Library for Arduino, ESP8266 & EPS32
66
paragraph=ThingSpeak ( https://www.thingspeak.com ) is an analytic IoT platform service that allows you to aggregate, visualize and analyze live data streams in the cloud.
77
category=Communication
88
url=https://www.thingspeak.com/
9-
architectures=avr,esp8266,sam,samd,esp32,samd_beta,megaavr
9+
architectures=avr,esp8266,sam,samd,esp32,megaavr,renesas,renesas_portenta,renesas_uno,rp2040,rp2350

src/ThingSpeak.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
ThingSpeak ( https://www.thingspeak.com ) is an analytic IoT platform service that allows you to aggregate, visualize and
55
analyze live data streams in the cloud.
66
7-
Copyright 2017, The MathWorks, Inc.
7+
Copyright 2017-2025, The MathWorks, Inc.
88
9-
See the accompaning licence file for licensing information.
9+
See the accompanying license file for licensing information.
1010
*/
1111

1212
#include "ThingSpeak.h"

src/ThingSpeak.h

Lines changed: 13 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
ThingSpeak ( https://www.thingspeak.com ) is an analytic IoT platform service that allows you to aggregate, visualize and
88
analyze live data streams in the cloud.
99
10-
Copyright 2020, The MathWorks, Inc.
10+
Copyright 2020-2025, The MathWorks, Inc.
1111
12-
See the accompaning licence file for licensing information.
12+
See the accompanying license file for licensing information.
1313
*/
1414

1515
// #define PRINT_DEBUG_MESSAGES
@@ -18,7 +18,7 @@
1818
#ifndef ThingSpeak_h
1919
#define ThingSpeak_h
2020

21-
#define TS_VER "2.0.0"
21+
#define TS_VER "2.1.0"
2222

2323
#include "Arduino.h"
2424
#include <Client.h>
@@ -43,12 +43,16 @@
4343
#define TS_USER_AGENT "tslib-arduino/" TS_VER " (arduino samd)"
4444
#elif defined(ARDUINO_ARCH_SAM)
4545
#define TS_USER_AGENT "tslib-arduino/" TS_VER " (arduino sam)"
46-
#elif defined(ARDUINO_ARCH_SAMD_BETA)
47-
#define TS_USER_AGENT "tslib-arduino/" TS_VER " (arduino samd_beta )"
4846
#elif defined(ARDUINO_ARCH_ESP32)
4947
#define TS_USER_AGENT "tslib-arduino/" TS_VER " (ESP32)"
50-
#elif defined(ARDUINO_ARCH_SAMD_BETA)
51-
#define TS_USER_AGENT "tslib-arduino/" TS_VER " (arduino vidor)"
48+
#elif defined(ARDUINO_ARCH_RENESAS_UNO)
49+
#define TS_USER_AGENT "tslib-arduino/" TS_VER " (arduino r4 uno)"
50+
#elif defined(ARDUINO_ARCH_RENESAS_PORTENTA)
51+
#define TS_USER_AGENT "tslib-arduino/" TS_VER " (arduino portenta)"
52+
#elif defined(ARDUINO_ARCH_RP2040)
53+
#define TS_USER_AGENT "tslib-arduino/" TS_VER " (raspberry pi rp2040)"
54+
#elif defined(ARDUINO_ARCH_RP2350)
55+
#define TS_USER_AGENT "tslib-arduino/" TS_VER " (raspberry pi rp2350)"
5256
#else
5357
#define TS_USER_AGENT "tslib-arduino/" TS_VER " (unknown)"
5458
#endif
@@ -446,8 +450,7 @@
446450
447451
Notes:
448452
To record a status message on a write, call setStatus() then call writeFields().
449-
Use status to provide additonal details when writing a channel update.
450-
Additonally, status can be used by the ThingTweet App to send a message to Twitter.
453+
Use status to provide additional details when writing a channel update.
451454
*/
452455
int setStatus(String status)
453456
{
@@ -462,38 +465,6 @@
462465
}
463466

464467

465-
/*
466-
Function: setTwitterTweet
467-
468-
Summary:
469-
Set the Twitter account and message to use for an update to be tweeted.
470-
471-
Parameters:
472-
twitter - Twitter account name as a String.
473-
tweet - Twitter message as a String (UTF-8) limited to 140 character.
474-
475-
Returns:
476-
Code of 200 if successful.
477-
Code of -101 if string is too long (> 255 bytes)
478-
479-
Notes:
480-
To send a message to twitter call setTwitterTweet() then call writeFields().
481-
Prior to using this feature, a twitter account must be linked to your ThingSpeak account. Do this by logging into ThingSpeak and going to Apps, then ThingTweet and clicking Link Twitter Account.
482-
*/
483-
int setTwitterTweet(String twitter, String tweet){
484-
#ifdef PRINT_DEBUG_MESSAGES
485-
Serial.print("ts::setTwitterTweet(twitter: "); Serial.print(twitter); Serial.print(", tweet: "); Serial.print(tweet); Serial.println("\")");
486-
#endif
487-
// Max # bytes for ThingSpeak field is 255 (UTF-8)
488-
if((twitter.length() > FIELDLENGTH_MAX) || (tweet.length() > FIELDLENGTH_MAX)) return TS_ERR_OUT_OF_RANGE;
489-
490-
this->nextWriteTwitter = twitter;
491-
this->nextWriteTweet = tweet;
492-
493-
return TS_OK_SUCCESS;
494-
}
495-
496-
497468
/*
498469
Function: setCreatedAt
499470
@@ -629,24 +600,6 @@
629600
fFirstItem = false;
630601
}
631602

632-
if(this->nextWriteTwitter.length() > 0){
633-
if(!fFirstItem){
634-
if(!this->client->print("&")) return abortWriteRaw();
635-
}
636-
if(!this->client->print("twitter=")) return abortWriteRaw();
637-
if(!this->client->print(this->nextWriteTwitter)) return abortWriteRaw();
638-
fFirstItem = false;
639-
}
640-
641-
if(this->nextWriteTweet.length() > 0){
642-
if(!fFirstItem){
643-
if(!this->client->print("&")) return abortWriteRaw();
644-
}
645-
if(!this->client->print("tweet=")) return abortWriteRaw();
646-
if(!this->client->print(this->nextWriteTweet)) return abortWriteRaw();
647-
fFirstItem = false;
648-
}
649-
650603
if(this->nextWriteCreatedAt.length() > 0){
651604
if(!fFirstItem){
652605
if(!this->client->print("&")) return abortWriteRaw();
@@ -1375,14 +1328,6 @@
13751328
contentLen = contentLen + 8 + this->nextWriteStatus.length(); // &status=[value]
13761329
}
13771330

1378-
if(this->nextWriteTwitter.length() > 0){
1379-
contentLen = contentLen + 9 + this->nextWriteTwitter.length(); // &twitter=[value]
1380-
}
1381-
1382-
if(this->nextWriteTweet.length() > 0){
1383-
contentLen = contentLen + 7 + this->nextWriteTweet.length(); // &tweet=[value]
1384-
}
1385-
13861331
if(this->nextWriteCreatedAt.length() > 0){
13871332
contentLen = contentLen + 12 + this->nextWriteCreatedAt.length(); // &created_at=[value]
13881333
}
@@ -1540,8 +1485,6 @@
15401485
float nextWriteElevation;
15411486
int lastReadStatus;
15421487
String nextWriteStatus;
1543-
String nextWriteTwitter;
1544-
String nextWriteTweet;
15451488
String nextWriteCreatedAt;
15461489
#ifndef ARDUINO_AVR_UNO
15471490
feed lastFeed;
@@ -1597,7 +1540,7 @@
15971540
// make sure all of the HTTP request is pushed out of the buffer before looking for a response
15981541
this->client->flush();
15991542

1600-
long timeoutTime = millis() + TIMEOUT_MS_SERVERRESPONSE;
1543+
unsigned long timeoutTime = millis() + TIMEOUT_MS_SERVERRESPONSE;
16011544

16021545
while(this->client-> available() < 17){
16031546
delay(2);
@@ -1715,8 +1658,6 @@
17151658
this->nextWriteLongitude = NAN;
17161659
this->nextWriteElevation = NAN;
17171660
this->nextWriteStatus = "";
1718-
this->nextWriteTwitter = "";
1719-
this->nextWriteTweet = "";
17201661
this->nextWriteCreatedAt = "";
17211662
}
17221663
};

0 commit comments

Comments
 (0)