Commit 27788d41 authored by Maximilian Schnabel's avatar Maximilian Schnabel
Browse files

preemptively disconnect other existing EV3 objects

parent 6fca0231
......@@ -171,7 +171,16 @@ classdef EV3 < MaskedHandle
% brick.connect('usb', 'beep', 'on', );
% See also ISCONNECTED / :attr:`isConnected`
% save variables of base directory in vars
vars = evalin('base', 'whos');
for k = 1:length(vars)
% if another EV3 object exists, preemptively disconnect it to prevent connection error
if strcmp(vars(k).class, 'EV3')
evalin('base', [vars(k).name '.disconnect()'])
if ev3.isConnected
if isCommInterfaceValid(ev3.commInterface)
% Warning lead to confusion of students. Since brick connection is still working
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment