How to flash app.lamp object in App designer

10 次查看(过去 30 天)
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!

回答(1 个)

Praveen Reddy
Praveen Reddy 2023-3-14
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:

类别

Help CenterFile Exchange 中查找有关 Develop Apps Using App Designer 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by