How to read the data from Arduino and perform actions accordingly in MIT APP

Hello, can anyone tell me if there is a way to "read' the data from Arduino. We can print or show the Arduino data to the app but I want to do actions in app according to the data from arduino. Like, if arduino sends "1" then the app should open screen1 otherwise it should open screen2.

This might help you,

Hello Haris

The snag there is moving to another Screen will disconnect Bluetooth :upside_down_face:

To avoid issues like that, instead of a number of Screens, use Virtual Screens instead.

When we define virtual screens, we use one 'real' App Inventor Screen (most often Screen1). Screen-sized Vertical Arrangements on it are displayed/hidden as required - they are the Virtual Screens. This is generally a better approach for multi-screen Apps, they share data without having to "pass" it between screens and it also reduces code duplication, making the App more efficient and the code easier to follow if you have to return to it at a later date.

So, instead of separate "houses", virtual screens are "rooms" of the same "house".

To use Arduino to drive something in the App, you can use a simple If Else with the value received.

2 Likes