sending and reading data with wifi connection is less than an hour of work
I ve done it in many small projects.
BLE works different and thats why i am struggling alot .
Take care Chris,cu later
I'm not here now but if I was I'd say use the App to tell Arduino to collect the data and send directly, if that is possible in your setup, which would avoid the delay that the App ("the middle man") will potentially produce.
If it has to be via the App and we can't send all the values together, then we need to try working with Web GET or POST. It's a matter of getting the syntax 100% perfect. App Inventor has more Blocks for POST, so that could be the best route and I have tried it, but without success as yet.
If app tell arduino to send the data , then the completely remote connection will be lost , if my arduino doesnt have a wifi signal
...the App can check if the Ardunio has a signal first. Any how, the App itself has the same potential issue when sending data.
Correct but the idea is that this is gonna be a wearable , that means we take with us wherever we go .
So in case you wanna go somehwere close or for a walk i know LoRA will fix my issue , but i want this project to be completely remote .
For example i wanna take this wearable and go to the mountains , and send data to TS server via APP if phone has Mb( no buying a sim card on arduino will be faaaar too costly).
Its kinda Weird what i want to achieve with this , i just came up with this idea and it was too interesting
Not sure you will have a good enough signal in the mountains
Anyway - discovered the issue when the test sent only 1 value - ThingSpeak doesn't like it! Requires a stream. The free version however is very slow, they promise fast performance with the business version.
Knowing all that, I have a working example using Web GET. No json required (remove from Channel setting if you have that).
Edit this project to insert your Write Key, then run via the companion on your phone.
ThingspeakTest2.aia (6.3 KB)
Hello Chris ,Good Morning .
Your example works And it actually sends normal values to my channel.
I implemented it to my code and it connects but again :
While it shows its uploading the value , it reads it as 0.
All i can think off is that the value is not an integer the moment the app receives it , because in your example, the value is an integer the moment it leaves the app and joins Thingspeak.
So i know that the value gets into a String in order to be sent but the app doesnt recognize it as an integer in the first place .
Its like we remove " " from the string value we receive from arduino and then we pass it again to a String .
Changed API key no worries
I tried this :
but now it doesnt even connect.
The idea is that we need something like this
String [] str = {"123", "345", "437", "894"};
int size = str.length;
int [] arr = new int [size];
for(int i=0; i<size; i++) {
arr[i] = Integer.parseInt(str[i]);
No, it's part of the URL string and therefore it's a string representing an integer, a string without any decoration (no speech marks or brackets).
its set to 0 and receives an integer ,
Then this integer becomes part of the URL and it becomes a String , but before is being sent its an actual int right?
That is true, but should make no difference.
If you want to, you can "intify" your cleaned-up string by adding a math zero to it.
I suggest you set the Label_Msg as I have, this shows exactly the assembled URL.
...and since you have doubts in your mind, here is an example where the values are strings and have never been integers:
ThingspeakTest3.aia (7.3 KB)
Amazing , then the App inventor should be correct as it is right now .
So maybe my Code is Wrong or i have no idea whats going on really.
Nor do I
Did you try:
Also, is there something odd on the ThingSpeak side? I'm just using a tiny fraction of it as I know next to nothing about it.
Since it was uploading your example ,i really have no idea whats going on .
Maybe i should try another platform , or start coding my App in Java
.......Well, I think that might be like jumping out of the frying pan and into the fire.
My only problem and the biggest one , is that i ve never made an app that connects to BLE so yea
But really thanks alot for your time that u devoted , i really appreciate it .
I think it's a case of "the devil is in the detail" - on the app side, the syntax has to be 100% correct. On the ThingSpeak side, it might be worth starting again with a new account.