In App Inventor, a Procedure is a block of code that can be called on to run at any time. This saves time and space when you need to run the same code over and over again.
- From the Procedures blocks, add the Do block.
- Name this procedure “SendToParticle“.
- Add the Set Web1 block from the Web1 section to the new procedure.
- Now we will assemble a string for the set Web1.Url by using the Join block from Text.
- All together we will be joining the serverURL, deviceID, “/“, Fun, “?access_token=“, and accessToken.
- Under the Set.Url block, we will add a Call.PostText block from the Web1 section.
- To this we will add a Join block for sending to our Particle function via POSTrequest.
- We will join “params=” and the Var value.
When ever this procedure is called Val will be sent via POST to:
https://api.particle.io/v1/devices/your-device-id/led?access_token=your-access-token
Page last edited April 18, 2016
Text editor powered by tinymce.