i am using myrpi variable inside a while loop. i am gettng an error as undefine function or variable myrpi. code is " if isempty(bbox) disp('No one is Here turn off all connection')else disp('someone is here in the room')"Please help
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
sanjay singh
el 8 de Abr. de 2018
Comentada: sanjay singh
el 9 de Abr. de 2018
code:
if isempty(bbox)
disp('No one is Here turn off all connection')
else
disp('someone is here in the room turn on supply ')
for i = 1:10
writeDigitalPin(rpi, 4, 1);
pause(0.5);
writeDigitalPin(rpi, 4, 0);
pause(0.5);
end
error:
Undefined function or variable 'rpi'.
Error in finalprogram1 (line 27)
writeDigitalPin(rpi, 4, 1);
1 comentario
Von Duesenberg
el 8 de Abr. de 2018
You probably deleted the rpi object at some point (or failed to initialize it).
Respuesta aceptada
Von Duesenberg
el 9 de Abr. de 2018
Editada: Von Duesenberg
el 9 de Abr. de 2018
I am not sure what the first clearvars is doing(the formatting of your code as it appears here probably lacks a number of end of lines characters) but the second one clears all variables except a variable called mypi... you called your raspi object rpi (not mypi), so it gets deleted by the call to clearvars. In other words, the following should do the trick:
clearvars -except rpi myCam flag
Más respuestas (1)
Ver también
Categorías
Más información sobre MATLAB Support Package for Raspberry Pi Hardware en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!