Converting 4 bytes to integer

according to the documentation snippet provided by @ChrisWard , the Post method should be used...

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

There is a further documentation snippet that uses GET. The OP omitted a large portion of the syntax.

Write data with GET
https://uk.mathworks.com/help/thingspeak/writedata.html

example:
https://api.thingspeak.com/update.json?api_key=<write_api_key>&field1=123

I used @ChrisWard format with Get and didnt worked , i tried with of different methods , even with MQTT extensions for app inventor.

I got it going with the same block , but now used replace all text like Chris provided
image .

Now TS channel is being updated but again 0 valuesimage .

Does replace all text works as Integer.ParseInt(string here) or is it just removing the " " ??
Because if its the latter , thats why i dont get a value on TS.

P.S Actually i read the Help on replace all so , we get another String just without " " . Thats why i get 0 readings , this value somehow must be parsedtoInt.

P.S 2: if there is no way to convert a string to an actualy number , then there is a chance that we can convert this string to Json and send it over ,but it will be last resort

Hello again

You have not created the 'StringsReceived' Block exactly as I have shown, which exactly matches the example by mathworks. Please do that, run the App and screenshot the entire Block with DoIt applied.

Hello Chris
using this

Doesnt upload Anything. Doesnt even connect actually

my Block followed an example from here : ESP32. MQTT. Broker. Publish. Subscribe. ThingSpeak

And it uploads to server like that , it just uploads 0 values

Your StringsReceived Block is not quite right - 'Thingspeak_List' is intiatised as a List, which changes the "decoration" of the value. notice that I replaced it with 'StringIntReceived' initialized as text.

indeed u are right but still doesnt connects to server .

Segment to text just removes " " so it still a string . Its like fooling myself .
it doesnt convert the string to an actual number .
I read a method to do that is base 10 convert to bin in the math section but i am getting errors for number 0.

The value is assembled as part of the URL. Therefore, the value must be represented by a string. You can change the string to an int, but the moment you concatenate it into a URL, it becomes a string.

Try the full Url string in your Browser - does that work?

https://api.thingspeak.com/update.json?api_key=<write_api_key>&field1=123

Replace '<write_api_key>' with your key

I just ran a test, via the Companion, using a WebViewer instead of Web GET. Works well:

Well,

i dont know what i am doing wrong .
i just copy paste this : https://api.thingspeak.com/update.json
api_key=XXXXXXXXXXXXXXXX
field1=(where here should be the values).

But it doesnt do anything pfff. Where did u entered the Channel info ??

Ensure you are using your write key (not the read key)

Snap12

I ve tried with both Account profile user API key and the Write api key from the channel, and i really have no clue how it works for you sir.

And i mean i know where my Channel Id is located , but where do you place this ID in your code??? Cuz it seems you dont and automatically App finds it for you.

Also its on click method so it receives one fix value and sends it , point is the connection is being made , i dont know if sending alot of readings can actually interfere the connection(it shouldnt)

Not sending the Channel ID - I have only made the one Channel, so I think that is simply the default.

What the code produces and sends:
https://api.thingspeak.com/update.json?api_key=MB55555555555X&field1=123

I sent a few values, simply by tapping the button, which means each time the whole URL + Key + Value was being sent. As long as the taps had a second between them, the values were added to the chart, observed on my PC. It works, but much depends on what you want to see on Thingspeak.

Thingspeak questions:

  1. Why do you need to send data there? Is it so that other people can see your data?
  2. Would it be acceptable to collect all values, over the whole time interval, then send all values as a list (csv)?

Also I notice that they have examples where the Ardunio is sending data directly to Thingspeak.

I have to go out now, back this evening UK time.

to answer the Question .
1.Yes the Basic idea is for other people to see and also to show how the Chart on TS dynamically changes (on the phone app screen via webviewer).
2.I dont know if that would work ,probably not , as i ll be updating my channel every 1 second , i want it to Graph an ECG.