Update Switch status in app after switching LED on and off using arduino button

If you can switch the LED on/off on the Arduino, what is the point of having the App?

thank you very much for information linked with size of sended message - I will correct it in sketch.
to clarify situation: I will not switch led on Arduino, I can do this only via bluetooth, but there are posibilities that connection can be done from more than one device (not parallel of course) and here come the problem - when I switch something on one device and I will disconnect app it will remember lasr settings, but when in meantime somebody else will connect and change something I will not have real status despite I have last settings remeber, that's why I am looking for solution which will update app according actual status of arduino leds during app screen initialization.

maybe I can use cloudDB instead tinyDB - in my opinion it can solve the problem - what do you think?

A good choice for sharing yes. Any hardware failure on the microcontroller side of things may need to be taken into account too.

taking care about hardware will be like a second point, right now I have problem because I do not know in which way I can replace tinyDB block to cloudDB block - they have different extensions .... :frowning:

thanks in advance for support

It's almost a straight swap:

Edit: Include connection:

Snap094

thank you very much for support, if I understand good when I want to skip get data button it will work in below form?
image
and for rest of sliders the same way?
but one question - from where program will know that block get value will have data from Switch_mc63 and not from Switch_mc64 for example? on this time this is black magic for me but I go step by smal step forward, especially thanks for your help :slight_smile:

combination for Switchmc63 is working but in which way I should make the same for label ....
image

I wouldn't put the Get Value Block in Screen Initialise - it could fail there. Call a Procedure, as the last Block in Screen Initialise.

Via the Tag.

Can you use App Inventor's Blocks Image capture please - your snapshots are difficult to read!

Right-click in the Blocks work space and select "Download Blocks as Image".

download blocks

You need to collect the values one-at-a-time, correct? So use a loop, changing the loop item each time from a list.

How many switches are there? What is the label for?

I can help you with the Loop and List(s), but later tonight as I'm actually working on a building site right now :grin:

Snap095

1 Like

A very quick example showing how to setup the Lists and Loop:

You can add your Labels with a List of their own and populate them using the same Loop.

Click on the image to view/download.

CloudDb_SimpleExample.aia (3.2 KB)

1 Like

hi, sorry for late answer but I was out of home.
thanks for tip linked with download screen from block - next new thing which I know about this program hehe
answering for your questions:
I have 10 switches which switch on / off the led
I have 10 sliders which define the time of shining the led
I have 10 labels which gives exact information which time is set on slider
below you can see the whole code from inventor - right now it is configured in option that it is saving and taking remember values from tinyDB.
bease on your remarks I will try to rebuild this using cloud DB :slight_smile:
centralny.aia (67.9 KB)

I try to modify my code using your example but I think that I am making something wrong because all the time when I open app switches do not remeber last position before app closing, please can you verify. thank you

My code only shows you how to handle the collection of the values from CloudDb. You can use a similar loop to update the values @ CloudDb.

You probably want to start with just my code and build from there.

hehe, yes you are righ ... I tried build the code exactly on your example :slight_smile:

I will play with this, I hope I will reach the target, I will inform you about the results

but example which you show should work independently, yes? and should remember position of switch in your app? because I am switching on changing position and switching off and position is always off after next switch on

The graphical representation is remembered - up to you when the switch states are stored in CloudDb. In this quick example, they are stored on Button tap. You could run the same Procedure on App Exit.

Updated Project (No effort on the GUI side!)
CloudDb_SimpleExample.aia (4.1 KB)