Skip to content

Commit fde8ac8

Browse files
Add files via upload
1 parent 5d3d8e9 commit fde8ac8

File tree

6 files changed

+29
-59
lines changed

6 files changed

+29
-59
lines changed

examples/CheerLights/CheerLights.ino

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,20 @@
1818

1919
// ***********************************************************************************************************
2020
// This example selects the correct library to use based on the board selected under the Tools menu in the IDE.
21-
// Yun, Ethernet shield, WiFi101 shield, esp8266, ESP32 and MKR1000 are all supported.
21+
// Yun, Ethernet shield, WiFi101 shield and MKR1000 are supported.
22+
// EPS8266 and ESP32 are not compatible with this example.
2223
// With Yun, the default is that you're using the Ethernet connection.
2324
// If you're using a wi-fi 101 or ethernet shield (http://www.arduino.cc/en/Main/ArduinoWiFiShield), uncomment the corresponding line below
2425
// ***********************************************************************************************************
2526

2627
//#define USE_WIFI101_SHIELD
2728
//#define USE_ETHERNET_SHIELD
2829

29-
#if !defined(USE_WIFI101_SHIELD) && !defined(USE_ETHERNET_SHIELD) && !defined(ARDUINO_SAMD_MKR1000) && !defined(ARDUINO_AVR_YUN) && !defined(ARDUINO_ARCH_ESP8266) && !defined(ARDUINO_ARCH_ESP32)
30+
#if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
31+
#error "EPS8266 and ESP32 are not compatible with this example."
32+
#endif
33+
34+
#if !defined(USE_WIFI101_SHIELD) && !defined(USE_ETHERNET_SHIELD) && !defined(ARDUINO_SAMD_MKR1000) && !defined(ARDUINO_AVR_YUN)
3035
#error "Uncomment the #define for either USE_WIFI101_SHIELD or USE_ETHERNET_SHIELD"
3136
#endif
3237

@@ -41,16 +46,10 @@ int pinBlue = 3;
4146
#include "YunClient.h"
4247
YunClient client;
4348
#else
44-
#if defined(USE_WIFI101_SHIELD) || defined(ARDUINO_SAMD_MKR1000) || defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
49+
#if defined(USE_WIFI101_SHIELD) || defined(ARDUINO_SAMD_MKR1000)
4550
// Use WiFi
46-
#ifdef ARDUINO_ARCH_ESP8266
47-
#include <ESP8266WiFi.h>
48-
#elif defined(ARDUINO_ARCH_ESP32)
49-
#include <WiFi.h>
50-
#else
51-
#include <SPI.h>
52-
#include <WiFi101.h>
53-
#endif
51+
#include <SPI.h>
52+
#include <WiFi101.h>
5453
char ssid[] = "<YOURNETWORK>"; // your network SSID (name)
5554
char pass[] = "<YOURPASSWORD>"; // your network password
5655
int status = WL_IDLE_STATUS;
@@ -77,7 +76,7 @@ void setup() {
7776
#ifdef ARDUINO_AVR_YUN
7877
Bridge.begin();
7978
#else
80-
#if defined(ARDUINO_ARCH_ESP8266) || defined(USE_WIFI101_SHIELD) || defined(ARDUINO_SAMD_MKR1000) || defined(ARDUINO_ARCH_ESP32)
79+
#if defined(USE_WIFI101_SHIELD) || defined(ARDUINO_SAMD_MKR1000)
8180
WiFi.begin(ssid, pass);
8281
#else
8382
Ethernet.begin(mac);

examples/ReadPrivateChannel/ReadPrivateChannel.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
// ***********************************************************************************************************
2222
// This example selects the correct library to use based on the board selected under the Tools menu in the IDE.
23-
// Yun, Ethernet shield, WiFi101 shield, esp8266, ESP32 and MXR1000 are all supported.
23+
// Yun, Ethernet shield, WiFi101 shield, esp8266, ESP32 and MKR1000 are all supported.
2424
// With Yun, the default is that you're using the Ethernet connection.
2525
// If you're using a wi-fi 101 or ethernet shield (http://www.arduino.cc/en/Main/ArduinoWiFiShield), uncomment the corresponding line below
2626
// ***********************************************************************************************************

examples/ReadWeatherStation/ReadWeatherStation.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
// ***********************************************************************************************************
1919
// This example selects the correct library to use based on the board selected under the Tools menu in the IDE.
20-
// Yun, Ethernet shield, WiFi101 shield, esp8266, ESP32, and MXR1000 are all supported.
20+
// Yun, Ethernet shield, WiFi101 shield, esp8266, ESP32, and MKR1000 are all supported.
2121
// With Yun, the default is that you're using the Ethernet connection.
2222
// If you're using a wi-fi 101 or ethernet shield (http://www.arduino.cc/en/Main/ArduinoWiFiShield), uncomment the corresponding line below
2323
// ***********************************************************************************************************
@@ -86,6 +86,7 @@ void setup() {
8686
#endif
8787

8888
ThingSpeak.begin(client);
89+
Serial.println("\nWaiting for first update...");
8990
delay(20000); // Give the WiFi some time to connect
9091
}
9192

examples/WriteMultipleVoltages/WriteMultipleVoltages.ino

Lines changed: 12 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -9,41 +9,38 @@
99
Copyright 2017, The MathWorks, Inc.
1010
1111
Documentation for the ThingSpeak Communication Library for Arduino is in the extras/documentation folder where the library was installed.
12-
See the accompaning licence file for licensing information.
12+
See the accompanying license file for licensing information.
1313
*/
1414

1515
#include "ThingSpeak.h"
1616

1717
// ***********************************************************************************************************
1818
// This example selects the correct library to use based on the board selected under the Tools menu in the IDE.
19-
// Yun, Ethernet shield, WiFi101 shield, esp8266, ESP32 and MXR1000 are all supported. Please note, ADC analogRead() for ESP32 has not yet
20-
// been implemented in the SparkFun library. It will always return 0.
19+
// Yun, Ethernet shield, WiFi101 shield and MKR1000 are supported.
20+
// EPS8266 and ESP32 are not compatible with this example.
2121
// With Yun, the default is that you're using the Ethernet connection.
2222
// If you're using a wi-fi 101 or ethernet shield (http://www.arduino.cc/en/Main/ArduinoWiFiShield), uncomment the corresponding line below
2323
// ***********************************************************************************************************
2424

2525
//#define USE_WIFI101_SHIELD
2626
//#define USE_ETHERNET_SHIELD
2727

28+
#if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
29+
#error "EPS8266 and ESP32 are not compatible with this example."
30+
#endif
2831

29-
#if !defined(USE_WIFI101_SHIELD) && !defined(USE_ETHERNET_SHIELD) && !defined(ARDUINO_SAMD_MKR1000) && !defined(ARDUINO_AVR_YUN) && !defined(ARDUINO_ARCH_ESP8266) && !defined(ARDUINO_ARCH_ESP32)
32+
#if !defined(USE_WIFI101_SHIELD) && !defined(USE_ETHERNET_SHIELD) && !defined(ARDUINO_SAMD_MKR1000) && !defined(ARDUINO_AVR_YUN)
3033
#error "Uncomment the #define for either USE_WIFI101_SHIELD or USE_ETHERNET_SHIELD"
3134
#endif
3235

3336
#if defined(ARDUINO_AVR_YUN)
3437
#include "YunClient.h"
3538
YunClient client;
3639
#else
37-
#if defined(USE_WIFI101_SHIELD) || defined(ARDUINO_SAMD_MKR1000) || defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
40+
#if defined(USE_WIFI101_SHIELD) || defined(ARDUINO_SAMD_MKR1000)
3841
// Use WiFi
39-
#ifdef ARDUINO_ARCH_ESP8266
40-
#include <ESP8266WiFi.h>
41-
#elif defined(ARDUINO_ARCH_ESP32)
42-
#include <WiFi.h>
43-
#else
44-
#include <SPI.h>
45-
#include <WiFi101.h>
46-
#endif
42+
#include <SPI.h>
43+
#include <WiFi101.h>
4744
char ssid[] = "<YOURNETWORK>"; // your network SSID (name)
4845
char pass[] = "<YOURPASSWORD>"; // your network password
4946
int status = WL_IDLE_STATUS;
@@ -69,14 +66,6 @@
6966
// On Due: 0 - 1023 maps to 0 - 3.3 volts
7067
#define VOLTAGE_MAX 3.3
7168
#define VOLTAGE_MAXCOUNTS 1023.0
72-
#elif ARDUINO_ARCH_ESP8266
73-
// On ESP8266: 0 - 1023 maps to 0 - 1 volts
74-
#define VOLTAGE_MAX 1.0
75-
#define VOLTAGE_MAXCOUNTS 1023.0
76-
#elif ARDUINO_ARCH_ESP32
77-
// On ESP32: 0 - 4096 maps to 0 - 1 volts
78-
#define VOLTAGE_MAX 1.0
79-
#define VOLTAGE_MAXCOUNTS 4095.0
8069
#endif
8170

8271

@@ -95,8 +84,8 @@ void setup() {
9584
#ifdef ARDUINO_AVR_YUN
9685
Bridge.begin();
9786
#else
98-
#if defined(ARDUINO_ARCH_ESP8266) || defined(USE_WIFI101_SHIELD) || defined(ARDUINO_SAMD_MKR1000) || defined(ARDUINO_ARCH_ESP32)
99-
WiFi.begin(ssid, pass);
87+
#if defined(USE_WIFI101_SHIELD) || defined(ARDUINO_SAMD_MKR1000)
88+
WiFi.begin(ssid, pass);
10089
#else
10190
Ethernet.begin(mac);
10291
#endif
@@ -109,28 +98,9 @@ void setup() {
10998
void loop() {
11099
// Read the input on each pin, convert the reading, and set each field to be sent to ThingSpeak.
111100
// On Uno,Mega,Yun: 0 - 1023 maps to 0 - 5 volts
112-
// On ESP8266: 0 - 1023 maps to 0 - 1 volts
113-
// On ESP32: 0 - 4095 maps to 0 - 1 volts, but will always return 0 as analogRead() has not been implemented yet
114101
// On MKR1000,Due: 0 - 4095 maps to 0 - 3.3 volts
115102
float pinVoltage = analogRead(A0) * (VOLTAGE_MAX / VOLTAGE_MAXCOUNTS);
116103
ThingSpeak.setField(1,pinVoltage);
117-
#if !defined(ARDUINO_ARCH_ESP8266) && !defined(ARDUINO_ARCH_ESP32)
118-
// The ESP8266 only has one analog input, so skip this
119-
pinVoltage = analogRead(A1) * (VOLTAGE_MAX / VOLTAGE_MAXCOUNTS);
120-
ThingSpeak.setField(2,pinVoltage);
121-
pinVoltage = analogRead(A2) * (VOLTAGE_MAX / VOLTAGE_MAXCOUNTS);
122-
ThingSpeak.setField(3,pinVoltage);
123-
pinVoltage = analogRead(A3) * (VOLTAGE_MAX / VOLTAGE_MAXCOUNTS);
124-
ThingSpeak.setField(4,pinVoltage);
125-
pinVoltage = analogRead(A4) * (VOLTAGE_MAX / VOLTAGE_MAXCOUNTS);
126-
ThingSpeak.setField(5,pinVoltage);
127-
pinVoltage = analogRead(A5) * (VOLTAGE_MAX / VOLTAGE_MAXCOUNTS);
128-
ThingSpeak.setField(6,pinVoltage);
129-
pinVoltage = analogRead(A6) * (VOLTAGE_MAX / VOLTAGE_MAXCOUNTS);
130-
ThingSpeak.setField(7,pinVoltage);
131-
pinVoltage = analogRead(A7) * (VOLTAGE_MAX / VOLTAGE_MAXCOUNTS);
132-
ThingSpeak.setField(8,pinVoltage);
133-
#endif
134104

135105
// Write the fields that you've set all at once.
136106
ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);

examples/WriteVoltage/WriteVoltage.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
// ***********************************************************************************************************
1818
// This example selects the correct library to use based on the board selected under the Tools menu in the IDE.
19-
// Yun, Ethernet shield, WiFi101 shield, esp8266, ESP32 and MXR1000 are all supported. Please note, ADC analogRead() for ESP32 has not yet
20-
// been implemented in the SparkFun library. It will always return 0.
19+
// Yun, Ethernet shield, WiFi101 shield, esp8266 and MKR1000 are all supported.
20+
// EPS32 is only partially compatible. ADC analogRead() for ESP32 has not yet been implemented in the SparkFun library. It will always return 0.
2121
// With Yun, the default is that you're using the Ethernet connection.
2222
// If you're using a wi-fi 101 or ethernet shield (http://www.arduino.cc/en/Main/ArduinoWiFiShield), uncomment the corresponding line below
2323
// ***********************************************************************************************************

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=ThingSpeak
2-
version=1.3.2
2+
version=1.3.3
33
author=MathWorks <[email protected]>
44
maintainer=MathWorks <[email protected]>
55
sentence=ThingSpeak Communication Library for Arduino, ESP8266 & EPS32

0 commit comments

Comments
 (0)