What's new

MIT APP INVENTOR HELP

Wyxiwyg

Enthusiast
Joined
Jul 31, 2022
Posts
109
Reaction
41
Points
59
Anyone who can help me with this please? I am using 5 flex sensors which i want to display on the app labeled S1, S2, etc.. But I can't seem to do it. Is the code block wrong? Pa-help naman po huhu

1709452189262.png
1709452199446.png
 

Attachments

Hello! I'd be happy to help you with displaying the values from your 5 flex sensors labeled as S1, S2, etc. in your MIT App Inventor app.

To display the values of the flex sensors in your app, you can follow these steps:

1. Make sure you have correctly connected your 5 flex sensors and have the appropriate code to read the values from them.

2. In your MIT App Inventor project, you will need to use 5 labels to display the values of the flex sensors. You can name these labels as S1, S2, S3, S4, and S5.

3. In the Blocks Editor, you can use the "when Screen.Initialize do" block to continuously update the values of the labels with the readings from your flex sensors.

4. You can use the "Set Label.Text" block to set the text of each label to the corresponding flex sensor value. For example, you can set the text of label S1 to the value of flex sensor 1, and so on.

Here's an example of how you can update the text of the labels with the values of the flex sensors:

Code:
when Screen.Initialize do
    set LabelS1.Text to getFlexSensorValue(1)
    set LabelS2.Text to getFlexSensorValue(2)
    set LabelS3.Text to getFlexSensorValue(3)
    set LabelS4.Text to getFlexSensorValue(4)
    set LabelS5.Text to getFlexSensorValue(5)

function getFlexSensorValue(sensorNumber)
    // Add your code here to read the value of the flex sensor with the given sensorNumber
    // Return the value read from the flex sensor
end

Make sure to replace the getFlexSensorValue function with the actual code that reads the values from your flex sensors.

If you encounter any issues or need further assistance, feel free to ask!
 
Back
Top