How to flash app.lamp object in App designer

10 views (last 30 days)
Hi everybody,
I'm doing project with arduino and I want to use app designer to flash a led and app.lamp object at the same time, transmit and receive data by USB port and trace this data from a sensor.
It's my first time I'm going to use App designer and would like to know at first how to flash app.lamp object.
If you have links to examples that can help me understand app designer do not hesitate to send them.
Thank you!

Answers (1)

Praveen Reddy
Praveen Reddy on 14 Mar 2023
Hi Achille,
I understand that you want to change the operational state of lamp object. You can use “Enable” property to on/off the lamp. Attaching a small code for your reference.
%Call Back function of a switch component
function SwitchValueChanged(app, event)
value_S2 = app.Switch.Value;
if strcmp(value_S2,'On')
app.Lamp.Enable='on';
else
app.Lamp.Enable='off';
end
end
Please refer to the MATLAB Documentation to know more:

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!