[SOLVED] How do I retrieve and use exposed variables in the MIT App Inventor?

I’ve read through a number of posts here, searched Google and tried to wrap my head around the demo project created by Team Practical Projects for communicating between the Photon and the App creator, but I’m just not finding what I’m looking for.

It seems like a basic thing, but my lack of experience is making it difficult. I’ve exposed two variables to the cloud on my Photon - startLit and endLit. These are just basic integers that refer to LEDs on a strip. I want to create a simple app that first reads the current values on the device, does some math, and sends it back to the Photon based on which buttons are tapped in the app. I just can’t figure out which blocks in the MIT App Inventor actual do those calls.

I realize I could go the long way and build functions onto the Photon and just call those functions for adding/subtracting, but I feel like keeping the on the app is better for memory optimization and scalability.

There are some threads in this forum that already deal with App Inventor questions

Although this is calling a Particle.function() rather than getting a Particle.variable(), but the principle is the same.

The difference is that you need a GET request (not POST as for functions) and catch the response (which really should be done with the function call too).

The documentation of the respective request can be found here

The response will be in JSON format and can be parsed as shown here

Thank you, this was a great jumping off point.

1 Like