Android app - thingspeak - arduino | Arduino | Forum

Avatar

Please consider registering
Guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —






— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed sp_TopicIcon
Android app - thingspeak - arduino
No permission to create posts
June 22, 2019
3:55 pm
Avatar
Blacktea
New Member
Members
Forum Posts: 1
Member Since:
June 22, 2019
sp_UserOfflineSmall Offline

Hi, i'm going to finish a project but i got stuck using an array sent from my Android app to Thingspeak (field 8) and then trying to get it from Arduino to assign data array to multiple variables.

So, from Android i send this URL : https://api.thingspeak.com/update.json?api_key=WRITE_API_KEY&field8=1,5,30,100,30,150,60,215,245 and it correctly saves it.

Now from my compatible Arduino board ( Wemos D1) i collect data from field 8 in this way

....
String alarmsList = ThingSpeak.readStringField(myChannelNumber, alarmsFieldNumber, myReadAPIKey);

int alarmsList_len = alarmsList.length() + 1;

int Allarmi[alarmsList_len];

alarmsList.toCharArray(Allarmi, alarmsList_len);

var_allarme_1 = alarmsList[0];
Serial.println(var_allarme_1);

but it doesn't work 🙁
Arduino IDE says:
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Arduino:1.8.9 (Windows 10), Scheda:"WeMos D1 R1, 80 MHz, Flash, Disabled, 4M (1M SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 115200"
Name.ino: In function 'void loop()':
Name_1.0:187:49: error: no matching function for call to 'String::toCharArray(int [(((sizetype)(((ssizetype)alarmsList_len) + -1)) + 1)], int&)'
alarmsList.toCharArray(Allarmi, alarmsList_len);
^
In file included from C:\Users\jasnandrea\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0\cores\esp8266/Arduino.h:261:0,
from sketch
ame.ino.cpp:1:
C:\Users\jasnandrea\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0\cores\esp8266/WString.h:208:14: note: void String::toCharArray(char*, unsigned int, unsigned int) const
void toCharArray(char *buf, unsigned int bufsize, unsigned int index = 0) const {
^
C:\Users\jasnandrea\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0\cores\esp8266/WString.h:208:14: note: no known conversion for argument 1 from 'int [(((sizetype)(((ssizetype)alarmsList_len) + -1)) + 1)]' to 'char*'
exit status 1
no matching function for call to 'String::toCharArray(int [(((sizetype)(((ssizetype)alarmsList_len) + -1)) + 1)], int
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Does anyone have any advice for me?

June 24, 2019
9:32 am
Avatar
cstapels
Moderator
Members


Moderators
Forum Posts: 861
Member Since:
March 7, 2017
sp_UserOfflineSmall Offline

You will probably have better luck on an Arduino forum or a C forum. The error is not with the ThingSpeak part, I think its with the datatypes for the variables in your toCharArray() call.

Forum Timezone: America/New_York

Most Users Ever Online: 166

Currently Online:
17 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 272

Vinod: 240

piajola: 95

turgo: 70

vespapierre: 63

Adarsh_Murthy: 62

Member Stats:

Guest Posters: 1

Members: 8665

Moderators: 1

Admins: 2

Forum Stats:

Groups: 3

Forums: 14

Topics: 1600

Posts: 5760

Newest Members:

khanhNguyen_CT, susyburr, quijano__, meosuckhoe, briskpanda, Dejw0089

Moderators: cstapels: 460

Administrators: Hans: 405, lee: 457