diff --git a/docs/__pycache__/process.cpython-34.pyc b/docs/__pycache__/process.cpython-34.pyc
index 72a3216e4451f8d86b36f77e963e9f54436941fb..6728adc9ab62652c61f69c5e960f7cf4e8770972 100644
Binary files a/docs/__pycache__/process.cpython-34.pyc and b/docs/__pycache__/process.cpython-34.pyc differ
diff --git a/docs/_build/doctrees/EV3.doctree b/docs/_build/doctrees/EV3.doctree
index 8bcf5816563022e22375681e2b9f5bba6158df8d..81b85669f84f7c552d0c9d5036666af357bfad90 100644
Binary files a/docs/_build/doctrees/EV3.doctree and b/docs/_build/doctrees/EV3.doctree differ
diff --git a/docs/_build/doctrees/Motor.doctree b/docs/_build/doctrees/Motor.doctree
index d2c25aa5b334227b782ed108af262833996d6d2c..99bd358f2448805b5bbb924e554bf55b2d155f4f 100644
Binary files a/docs/_build/doctrees/Motor.doctree and b/docs/_build/doctrees/Motor.doctree differ
diff --git a/docs/_build/doctrees/Sensor.doctree b/docs/_build/doctrees/Sensor.doctree
index 53b1b15cfb8aecfaa610a796a1733f558e82466a..0ce62acba0af1478fbe7f507ef62fd2752a3ad6b 100644
Binary files a/docs/_build/doctrees/Sensor.doctree and b/docs/_build/doctrees/Sensor.doctree differ
diff --git a/docs/_build/doctrees/btBrickIO.doctree b/docs/_build/doctrees/btBrickIO.doctree
index 74ba22f6fe18f6c9be8d57ddd816dd69b82093bc..41720b5e50a9481d2562533c6c3dc1e3be9b113b 100644
Binary files a/docs/_build/doctrees/btBrickIO.doctree and b/docs/_build/doctrees/btBrickIO.doctree differ
diff --git a/docs/_build/doctrees/environment.pickle b/docs/_build/doctrees/environment.pickle
index 493559a4ac890cf230bcbe9931c732ba5043292d..e4ce3fdf6c5c888c12a177e99fad5280af4ccfe4 100644
Binary files a/docs/_build/doctrees/environment.pickle and b/docs/_build/doctrees/environment.pickle differ
diff --git a/docs/_build/doctrees/hid.doctree b/docs/_build/doctrees/hid.doctree
index c82dc29f649259c36cd8030319836dde14128f93..a836cbb5790318295ad88da50ea6ea89f8570986 100644
Binary files a/docs/_build/doctrees/hid.doctree and b/docs/_build/doctrees/hid.doctree differ
diff --git a/docs/_build/doctrees/source.doctree b/docs/_build/doctrees/source.doctree
index 28b2c3b4e8f71549ff09862e68ff0e902323679d..17d8e0196cbf8f7d8a2b0657997cbe30915fabc0 100644
Binary files a/docs/_build/doctrees/source.doctree and b/docs/_build/doctrees/source.doctree differ
diff --git a/docs/_build/doctrees/usbBrickIO.doctree b/docs/_build/doctrees/usbBrickIO.doctree
index 9e985aec95f348be9b34f7f920cb58c0f1c708b5..8c63e70472f80bd11bfe7873c0485d7a52c2ac41 100644
Binary files a/docs/_build/doctrees/usbBrickIO.doctree and b/docs/_build/doctrees/usbBrickIO.doctree differ
diff --git a/docs/_build/html/EV3.html b/docs/_build/html/EV3.html
index b00200a736ec3f7fa706afd7baccc6c3697e45f3..8dffa0e5745305e731aac6cf092421d7a9359f0e 100644
--- a/docs/_build/html/EV3.html
+++ b/docs/_build/html/EV3.html
@@ -146,20 +146,24 @@
 <dl class="class">
 <dt id="source.EV3">
 <em class="property">class </em><code class="descname">EV3</code><span class="sig-paren">(</span><em>varargin</em><span class="sig-paren">)</span><a class="headerlink" href="#source.EV3" title="Permalink to this definition">¶</a></dt>
-<dd><p>High-level class to work with physical bricks.</p>
-<p>This is the 'central' class (from user's view) when working with this toolbox. It
-delivers a convenient interface for creating a connection to the brick and sending
-commands to it. An EV3-object creates 4 Motor- and 4 Sensor-objects, one for each port.</p>
-<blockquote>
-<div><ul class="simple">
-<li><a class="reference internal" href="#source.EV3.setProperties" title="source.EV3.setProperties"><code class="xref mat mat-meth docutils literal"><span class="pre">setProperties()</span></code></a></li>
-<li><a class="reference internal" href="#source.EV3.beep" title="source.EV3.beep"><code class="xref mat mat-meth docutils literal"><span class="pre">beep()</span></code></a></li>
+<dd><dl class="docutils">
+<dt><em>List of methods</em>:</dt>
+<dd><ul class="first last simple">
+<li><a class="reference internal" href="#source.EV3.connect" title="source.EV3.connect"><code class="xref mat mat-meth docutils literal"><span class="pre">connect()</span></code></a></li>
+<li><a class="reference internal" href="#source.EV3.disconnect" title="source.EV3.disconnect"><code class="xref mat mat-meth docutils literal"><span class="pre">disconnect()</span></code></a></li>
 <li><a class="reference internal" href="#source.EV3.stopAllMotors" title="source.EV3.stopAllMotors"><code class="xref mat mat-meth docutils literal"><span class="pre">stopAllMotors()</span></code></a></li>
+<li><a class="reference internal" href="#source.EV3.beep" title="source.EV3.beep"><code class="xref mat mat-meth docutils literal"><span class="pre">beep()</span></code></a></li>
 <li><a class="reference internal" href="#source.EV3.playTone" title="source.EV3.playTone"><code class="xref mat mat-meth docutils literal"><span class="pre">playTone()</span></code></a></li>
 <li><a class="reference internal" href="#source.EV3.stopTone" title="source.EV3.stopTone"><code class="xref mat mat-meth docutils literal"><span class="pre">stopTone()</span></code></a></li>
 <li><a class="reference internal" href="#source.EV3.tonePlayed" title="source.EV3.tonePlayed"><code class="xref mat mat-meth docutils literal"><span class="pre">tonePlayed()</span></code></a></li>
+<li><a class="reference internal" href="#source.EV3.setProperties" title="source.EV3.setProperties"><code class="xref mat mat-meth docutils literal"><span class="pre">setProperties()</span></code></a></li>
 </ul>
-</div></blockquote>
+</dd>
+</dl>
+<p>High-level class to work with physical bricks.</p>
+<p>This is the 'central' class (from user's view) when working with this toolbox. It
+delivers a convenient interface for creating a connection to the brick and sending
+commands to it. An EV3-object creates 4 Motor- and 4 Sensor-objects, one for each port.</p>
 <p class="rubric">Notes</p>
 <ul class="simple">
 <li>Creating multiple EV3 objects and connecting them to different physical bricks has not
diff --git a/docs/_build/html/Motor.html b/docs/_build/html/Motor.html
index fef8e5c7289608c43f5c64d78ae595daa2dcb65f..ca7b2994609aeb46a61e498ebfbc6195f5b1314a 100644
--- a/docs/_build/html/Motor.html
+++ b/docs/_build/html/Motor.html
@@ -146,7 +146,22 @@
 <dl class="class">
 <dt id="source.Motor">
 <em class="property">class </em><code class="descname">Motor</code><span class="sig-paren">(</span><em>varargin</em><span class="sig-paren">)</span><a class="headerlink" href="#source.Motor" title="Permalink to this definition">¶</a></dt>
-<dd><p>High-level class to work with motors.</p>
+<dd><dl class="docutils">
+<dt><em>List of methods</em>:</dt>
+<dd><ul class="first last simple">
+<li><a class="reference internal" href="#source.Motor.start" title="source.Motor.start"><code class="xref mat mat-meth docutils literal"><span class="pre">start()</span></code></a></li>
+<li><a class="reference internal" href="#source.Motor.stop" title="source.Motor.stop"><code class="xref mat mat-meth docutils literal"><span class="pre">stop()</span></code></a></li>
+<li><a class="reference internal" href="#source.Motor.syncedStart" title="source.Motor.syncedStart"><code class="xref mat mat-meth docutils literal"><span class="pre">syncedStart()</span></code></a></li>
+<li><a class="reference internal" href="#source.Motor.syncedStop" title="source.Motor.syncedStop"><code class="xref mat mat-meth docutils literal"><span class="pre">syncedStop()</span></code></a></li>
+<li><a class="reference internal" href="#source.Motor.waitFor" title="source.Motor.waitFor"><code class="xref mat mat-meth docutils literal"><span class="pre">waitFor()</span></code></a></li>
+<li><a class="reference internal" href="#source.Motor.internalReset" title="source.Motor.internalReset"><code class="xref mat mat-meth docutils literal"><span class="pre">internalReset()</span></code></a></li>
+<li><a class="reference internal" href="#source.Motor.resetTachoCount" title="source.Motor.resetTachoCount"><code class="xref mat mat-meth docutils literal"><span class="pre">resetTachoCount()</span></code></a></li>
+<li><a class="reference internal" href="#source.Motor.setBrake" title="source.Motor.setBrake"><code class="xref mat mat-meth docutils literal"><span class="pre">setBrake()</span></code></a></li>
+<li><a class="reference internal" href="#source.Motor.setProperties" title="source.Motor.setProperties"><code class="xref mat mat-meth docutils literal"><span class="pre">setProperties()</span></code></a></li>
+</ul>
+</dd>
+</dl>
+<p>High-level class to work with motors.</p>
 <p>This class is supposed to ease the use of the brick's motors. It is possible to set all
 kinds of parameters, request the current status of the motor ports and of course send
 commands to the brick to be executed on the respective port.</p>
diff --git a/docs/_build/html/Sensor.html b/docs/_build/html/Sensor.html
index 0b01eea7504ee09929d70cc236077225e870911a..8dc47aee99d8b881f41a6de704e3bb3b05cbfb6d 100644
--- a/docs/_build/html/Sensor.html
+++ b/docs/_build/html/Sensor.html
@@ -146,7 +146,15 @@
 <dl class="class">
 <dt id="source.Sensor">
 <em class="property">class </em><code class="descname">Sensor</code><span class="sig-paren">(</span><em>varargin</em><span class="sig-paren">)</span><a class="headerlink" href="#source.Sensor" title="Permalink to this definition">¶</a></dt>
-<dd><p>High-level class to work with sensors.</p>
+<dd><dl class="docutils">
+<dt><em>List of methods</em>:</dt>
+<dd><ul class="first last simple">
+<li><a class="reference internal" href="#source.Sensor.reset" title="source.Sensor.reset"><code class="xref mat mat-meth docutils literal"><span class="pre">reset()</span></code></a></li>
+<li><a class="reference internal" href="#source.Sensor.setProperties" title="source.Sensor.setProperties"><code class="xref mat mat-meth docutils literal"><span class="pre">setProperties()</span></code></a></li>
+</ul>
+</dd>
+</dl>
+<p>High-level class to work with sensors.</p>
 <p>The Sensor-class facilitates the communication with sensors. This mainly consists of
 reading the sensor's type and current value in a specified mode.</p>
 <p class="rubric">Notes</p>
diff --git a/docs/_build/html/btBrickIO.html b/docs/_build/html/btBrickIO.html
index d0f42928462ae8a40faeb5609cb4a918026b2872..9ac6d3b9f9506fc264345c97c32d72d3bedc9fb3 100644
--- a/docs/_build/html/btBrickIO.html
+++ b/docs/_build/html/btBrickIO.html
@@ -141,7 +141,18 @@
 <dl class="class">
 <dt id="source.btBrickIO">
 <em class="property">class </em><code class="descname">btBrickIO</code><span class="sig-paren">(</span><em>varargin</em><span class="sig-paren">)</span><a class="headerlink" href="#source.btBrickIO" title="Permalink to this definition">¶</a></dt>
-<dd><p>Bluetooth interface between MATLAB and the brick</p>
+<dd><dl class="docutils">
+<dt><em>List of methods</em>:</dt>
+<dd><ul class="first last simple">
+<li><a class="reference internal" href="#source.btBrickIO.open" title="source.btBrickIO.open"><code class="xref mat mat-meth docutils literal"><span class="pre">open()</span></code></a></li>
+<li><a class="reference internal" href="#source.btBrickIO.close" title="source.btBrickIO.close"><code class="xref mat mat-meth docutils literal"><span class="pre">close()</span></code></a></li>
+<li><a class="reference internal" href="#source.btBrickIO.read" title="source.btBrickIO.read"><code class="xref mat mat-meth docutils literal"><span class="pre">read()</span></code></a></li>
+<li><a class="reference internal" href="#source.btBrickIO.write" title="source.btBrickIO.write"><code class="xref mat mat-meth docutils literal"><span class="pre">write()</span></code></a></li>
+<li><a class="reference internal" href="#source.btBrickIO.setProperties" title="source.btBrickIO.setProperties"><code class="xref mat mat-meth docutils literal"><span class="pre">setProperties()</span></code></a></li>
+</ul>
+</dd>
+</dl>
+<p>Bluetooth interface between MATLAB and the brick</p>
 <p class="rubric">Notes</p>
 <ul>
 <li><p class="first">Connects to the bluetooth module on the host through a serial
diff --git a/docs/_build/html/examples.html b/docs/_build/html/examples.html
index e3923d5ea81c24d428ff44d7588a4fcb485dc1aa..96fe6575db57fee9ba3982487e39e1304ccf4e8a 100644
--- a/docs/_build/html/examples.html
+++ b/docs/_build/html/examples.html
@@ -77,8 +77,7 @@
 <li class="toctree-l1"><a class="reference internal" href="Sensor.html">Sensor</a></li>
 </ul>
 <ul>
-<li class="toctree-l1"><a class="reference internal" href="CommandLayer.html">CommandLayer</a></li>
-<li class="toctree-l1"><a class="reference internal" href="CommunicationLayer.html">CommunicationLayer</a></li>
+<li class="toctree-l1"><a class="reference internal" href="hid.html">hidapi</a></li>
 <li class="toctree-l1"><a class="reference internal" href="usbBrickIO.html">usbBrickIO</a></li>
 <li class="toctree-l1"><a class="reference internal" href="btBrickIO.html">btBrickIO</a></li>
 </ul>
diff --git a/docs/_build/html/hid.html b/docs/_build/html/hid.html
index 702479f45ee7c7bf1863b281c7a1900bdb854550..deffa114aab5da46eb95089f36e78019a22f7b89 100644
--- a/docs/_build/html/hid.html
+++ b/docs/_build/html/hid.html
@@ -146,7 +146,27 @@
 <dl class="class">
 <dt id="source.hidapi">
 <em class="property">class </em><code class="descclassname">source.</code><code class="descname">hidapi</code><span class="sig-paren">(</span><em>vendorID</em>, <em>productID</em>, <em>nReadBuffer</em>, <em>nWriteBuffer</em><span class="sig-paren">)</span><a class="headerlink" href="#source.hidapi" title="Permalink to this definition">¶</a></dt>
-<dd><p>Interface to the hidapi library</p>
+<dd><dl class="docutils">
+<dt><em>List of methods</em>:</dt>
+<dd><ul class="first last simple">
+<li><a class="reference internal" href="#source.hidapi.open" title="source.hidapi.open"><code class="xref mat mat-meth docutils literal"><span class="pre">open()</span></code></a></li>
+<li><a class="reference internal" href="#source.hidapi.close" title="source.hidapi.close"><code class="xref mat mat-meth docutils literal"><span class="pre">close()</span></code></a></li>
+<li><a class="reference internal" href="#source.hidapi.read" title="source.hidapi.read"><code class="xref mat mat-meth docutils literal"><span class="pre">read()</span></code></a></li>
+<li><a class="reference internal" href="#source.hidapi.read_timeout" title="source.hidapi.read_timeout"><code class="xref mat mat-meth docutils literal"><span class="pre">read_timeout()</span></code></a></li>
+<li><a class="reference internal" href="#source.hidapi.write" title="source.hidapi.write"><code class="xref mat mat-meth docutils literal"><span class="pre">write()</span></code></a></li>
+<li><a class="reference internal" href="#source.hidapi.getHIDInfoString" title="source.hidapi.getHIDInfoString"><code class="xref mat mat-meth docutils literal"><span class="pre">getHIDInfoString()</span></code></a></li>
+<li><a class="reference internal" href="#source.hidapi.setNonBlocking" title="source.hidapi.setNonBlocking"><code class="xref mat mat-meth docutils literal"><span class="pre">setNonBlocking()</span></code></a></li>
+<li><a class="reference internal" href="#source.hidapi.init" title="source.hidapi.init"><code class="xref mat mat-meth docutils literal"><span class="pre">init()</span></code></a></li>
+<li><a class="reference internal" href="#source.hidapi.exit" title="source.hidapi.exit"><code class="xref mat mat-meth docutils literal"><span class="pre">exit()</span></code></a></li>
+<li><a class="reference internal" href="#source.hidapi.error" title="source.hidapi.error"><code class="xref mat mat-meth docutils literal"><span class="pre">error()</span></code></a></li>
+<li><a class="reference internal" href="#source.hidapi.enumerate" title="source.hidapi.enumerate"><code class="xref mat mat-meth docutils literal"><span class="pre">enumerate()</span></code></a></li>
+<li><a class="reference internal" href="#source.hidapi.getManufacturersString" title="source.hidapi.getManufacturersString"><code class="xref mat mat-meth docutils literal"><span class="pre">getManufacturersString()</span></code></a></li>
+<li><a class="reference internal" href="#source.hidapi.getProductString" title="source.hidapi.getProductString"><code class="xref mat mat-meth docutils literal"><span class="pre">getProductString()</span></code></a></li>
+<li><a class="reference internal" href="#source.hidapi.getSerialNumberString" title="source.hidapi.getSerialNumberString"><code class="xref mat mat-meth docutils literal"><span class="pre">getSerialNumberString()</span></code></a></li>
+</ul>
+</dd>
+</dl>
+<p>Interface to the hidapi library</p>
 <p class="rubric">Notes</p>
 <ul class="simple">
 <li>Developed from the hidapi available at <a class="reference external" href="http://www.signal11.us/oss/hidapi/">http://www.signal11.us/oss/hidapi/</a>.</li>
diff --git a/docs/_build/html/readme.html b/docs/_build/html/readme.html
index bb4d3aae47a7a83557fb263d6be241f60162d095..d1bcc12991bfd1b1d9de908d9a6c60cff3887251 100644
--- a/docs/_build/html/readme.html
+++ b/docs/_build/html/readme.html
@@ -77,8 +77,7 @@
 <li class="toctree-l1"><a class="reference internal" href="Sensor.html">Sensor</a></li>
 </ul>
 <ul>
-<li class="toctree-l1"><a class="reference internal" href="CommandLayer.html">CommandLayer</a></li>
-<li class="toctree-l1"><a class="reference internal" href="CommunicationLayer.html">CommunicationLayer</a></li>
+<li class="toctree-l1"><a class="reference internal" href="hid.html">hidapi</a></li>
 <li class="toctree-l1"><a class="reference internal" href="usbBrickIO.html">usbBrickIO</a></li>
 <li class="toctree-l1"><a class="reference internal" href="btBrickIO.html">btBrickIO</a></li>
 </ul>
diff --git a/docs/_build/html/searchindex.js b/docs/_build/html/searchindex.js
index 203583885789418532fdced5f80a294d58b4dcde..0b433017ac10e5201b230ecc7a9af6c53b5aa447 100644
--- a/docs/_build/html/searchindex.js
+++ b/docs/_build/html/searchindex.js
@@ -1 +1 @@
-Search.setIndex({envversion:49,filenames:["CommandLayer","CommunicationLayer","EV3","Motor","Sensor","btBrickIO","examples","hid","index","readme","source","usbBrickIO"],objects:{"":{source:[11,0,1,""]},"source.EV3":{batteryMode:[10,2,1,""],batteryValue:[10,2,1,""],beep:[10,3,1,""],connect:[10,3,1,""],debug:[10,2,1,""],disconnect:[10,3,1,""],isConnected:[10,2,1,""],motorA:[10,2,1,""],motorB:[10,2,1,""],motorC:[10,2,1,""],motorD:[10,2,1,""],playTone:[10,3,1,""],sensor1:[10,2,1,""],sensor2:[10,2,1,""],sensor3:[10,2,1,""],sensor4:[10,2,1,""],setProperties:[10,3,1,""],stopAllMotors:[10,3,1,""],stopTone:[10,3,1,""],tonePlayed:[10,3,1,""]},"source.Motor":{brakeMode:[3,2,1,""],currentSpeed:[3,2,1,""],debug:[3,2,1,""],internalReset:[3,3,1,""],isRunning:[3,2,1,""],limitMode:[3,2,1,""],limitValue:[3,2,1,""],power:[3,2,1,""],resetTachoCount:[3,3,1,""],setBrake:[3,3,1,""],setProperties:[3,3,1,""],smoothStart:[3,2,1,""],smoothStop:[3,2,1,""],speedRegulation:[3,2,1,""],start:[3,3,1,""],stop:[3,3,1,""],syncedStart:[3,3,1,""],syncedStop:[3,3,1,""],tachoCount:[3,2,1,""],type:[3,2,1,""],waitFor:[3,3,1,""]},"source.Sensor":{debug:[4,2,1,""],mode:[4,2,1,""],reset:[4,3,1,""],setProperties:[4,3,1,""],type:[4,2,1,""],value:[4,2,1,""]},"source.btBrickIO":{backend:[5,2,1,""],channel:[5,2,1,""],close:[5,3,1,""],debug:[5,2,1,""],deviceName:[5,2,1,""],open:[5,3,1,""],read:[5,3,1,""],serialPort:[5,2,1,""],setProperties:[5,3,1,""],timeOut:[5,2,1,""],write:[5,3,1,""]},"source.hidapi":{close:[7,3,1,""],enumerate:[7,3,1,""],error:[7,3,1,""],exit:[7,3,1,""],getHIDInfoString:[7,3,1,""],getManufacturersString:[7,3,1,""],getProductString:[7,3,1,""],getSerialNumberString:[7,3,1,""],handle:[7,2,1,""],init:[7,3,1,""],nReadBuffer:[7,2,1,""],nWriteBuffer:[7,2,1,""],open:[7,3,1,""],productID:[7,2,1,""],read:[7,3,1,""],read_timeout:[7,3,1,""],setNonBlocking:[7,3,1,""],sheader:[7,2,1,""],slib:[7,2,1,""],vendorID:[7,2,1,""],write:[7,3,1,""]},"source.usbBrickIO":{close:[11,3,1,""],debug:[11,2,1,""],nReadBuffer:[11,2,1,""],nWriteBuffer:[11,2,1,""],open:[11,3,1,""],productID:[11,2,1,""],read:[11,3,1,""],setProperties:[11,3,1,""],timeOut:[11,2,1,""],vendorID:[11,2,1,""],write:[11,3,1,""]},source:{EV3:[10,1,1,""],Motor:[3,1,1,""],Sensor:[4,1,1,""],btBrickIO:[5,1,1,""],hidapi:[7,1,1,""],usbBrickIO:[11,1,1,""]}},objnames:{"0":["mat","module","MATLAB module"],"1":["mat","class","MATLAB class"],"2":["mat","attribute","MATLAB attribute"],"3":["mat","method","MATLAB method"]},objtypes:{"0":"mat:module","1":"mat:class","2":"mat:attribute","3":"mat:method"},terms:{"0x0005":11,"0x694":11,"2nd":[2,3,4,10],"5000hz":[2,10],"abstract":8,"byte":[7,11],"case":[3,11],"catch":3,"char":7,"class":[2,3,4,5,7,8,10,11],"default":[4,5,7,11],"final":7,"function":[3,7],"long":3,"null":7,"return":[2,3,5,7,10,11],"throw":7,"true":[2,3,5,10,11],"try":[3,5,11],"while":8,aachen:8,abl:8,about:[2,3,4,7,10],acceler:[3,4],accelerationallax:4,access:8,accident:[2,10],act:3,action:3,actual:[3,7,11],addit:7,advanc:8,affect:3,after:[3,5,7,11],afterward:3,again:3,all:[2,3,4,7,10,11],allow:4,alreadi:7,also:[2,3,4,5,7,10,11],alternatingli:[],alwai:[7,11],ambient:4,angular:4,ani:[3,11],announc:[2,3,4,10],anoth:3,append:7,apply:3,aren:3,argument:[2,3,4,10],around:3,arrai:[5,11],automat:[2,3,4,5,7,10],avail:[4,7],backend:5,base:5,batteri:[2,10],batterymod:[2,3,10],batterymode:[2,10],batteryvalu:[2,10],been:[2,3,4,5,10],beep:[2,6,10],befor:5,behav:3,behaviour:8,besid:11,better:3,between:[3,5,7,11],bigger:[7,11],bit:3,block:7,blue:4,bool:[2,3,4,5,10,11],both:3,brake:3,brakemod:3,brakemode:3,brick:[2,3,4,5,8,10,11],brickio:[5,11],brickobject:[2,3,4,10],buffer:[7,11],buggi:[],bump:4,c_output:3,call:[2,3,4,5,7,10,11],can:[3,4,5,8],car:3,cast:7,central:[2,10],chang:3,channel:5,charg:[2,10],check:[3,7],chosen:5,clear:4,close:[5,7,11],coast:3,code:4,col:4,color:4,com:[2,10],comm:[],comment:3,commerror:7,commhandl:[5,11],commun:[3,4,7,8],compil:7,connect:[2,3,4,5,6,7,10,11],connectiontyp:[2,10],consist:[3,4],consol:[2,3,4,5,10,11],constantli:3,constructor:11,contain:[2,3,4,10],continu:3,contribut:[],control:[],conveni:[2,10],correctli:3,correspond:7,could:[5,7,11],count:3,counter:3,cours:3,creat:[2,3,4,7,10],current:[2,3,4,10],currentspe:3,data:[5,7,11],dba:4,debug:[2,3,4,5,10,11],decim:7,defin:3,degre:[3,4],delet:[2,6,7,10],deliv:[2,10],depend:[2,3,4,5,7,10],design:8,destroi:[2,10],dev:[2,3,4,5,10],develop:[7,8],devic:[3,5,7,11],devicemod:4,devicenam:5,devicename:5,devicetyp:[3,4],differ:[2,7,10],direct:3,directli:[7,8],disabl:7,disconnect:[2,10],disp:[2,6,10],distcm:4,distin:4,dll:7,document:8,doe:[2,3,7,10,11],doesn:[],don:[3,4],done:3,down:3,durat:[2,10],dure:7,dylib:7,each:[2,3,4,5,10,11],eas:3,easili:8,either:[2,3,10],enabl:[2,7,10,11],enumer:7,equal:[2,3,10],error:[3,4,5,7,11],establish:[2,10],even:3,eventu:11,everytim:[3,4],exampl:[],execut:3,exit:7,expect:[2,6,10],explicitli:7,extens:7,facilit:4,fals:[3,5,11],far:3,fclose:5,feedback:[2,3,4,10],file:7,finish:3,firmwar:[2,3,10],first:[2,3,10],flag:7,follow:[2,3,4,5,8,10,11],fopen:5,format:[5,11],forward:3,four:3,fread:5,frequenc:[2,10],from:[2,3,4,5,7,10,11],front:7,fun:[2,6,10],fwrite:5,gener:[],germani:8,get:[2,3,7,8,10],gethidinfostr:7,getmanufacturersstr:7,getmanufacturersstring:7,getproductstr:7,getproductstring:7,getserialnumberstr:7,getserialnumberstring:7,given:[2,3,4,7,10],glanc:[2,10],goe:3,greater:3,green:4,gyro:4,handl:7,happen:3,have:[2,3,7,10],header:7,heavi:3,henc:5,here:3,hertz:[2,10],hid:[7,11],hid_device_infoptr:7,hid_open:7,hidapi:[],hidhandl:7,high:[2,3,4,8,10],highest:3,hold:3,host:[5,7],how:3,htacceleromet:4,htcolor:4,htcompass:4,http:7,hysic:4,imag:[],immedi:[2,3,10],implement:[5,11],indic:3,individu:[3,4],infinit:3,info:7,inform:[5,7],infrare:4,init:7,input:[2,3,4,10],inputpars:[2,3,4,5,10,11],instal:[7,8],installat:[],instanc:[3,4,7],instantan:[2,10],instead:[2,3,4,10],instruct:8,instrument:5,instrumentcontrol:5,int32:7,interfac:[2,5,7,10,11],intern:3,internalreset:3,interpret:3,intuit:8,invalid:7,invalidhandl:7,isconnect:[2,10],isconnected:[2,10],isrun:3,iter:[],itself:7,keep:3,kind:3,know:7,lab:8,largemotor:4,last:3,later:[],layer:[3,4,8],lead:[],left:3,length:7,less:3,level:[2,3,4,8,10],librari:[7,11],licens:[],like:3,limit:3,limitmod:3,limitvalu:[2,3,6,10],linux:[5,7],listen:4,load:3,look:8,loop:3,low:[2,8,10],lower:3,mac:[5,7],made:5,mai:[2,3,4,10],mainli:4,make:3,manufactur:7,mark:[2,3,4,10],master:3,matlab:[],maximum:11,mean:3,mediummotor:4,meet:8,messag:3,meth:[],method:[2,3,4,10],millisecond:[2,3,7,10,11],mind:3,mismatch:7,mode:[2,3,4,10],modul:5,mostli:[3,8],motor:[],motora:[2,3,4,6,10],motorb:[2,3,10],motorc:[2,10],motord:[2,10],move:3,multipl:[2,3,4,5,10,11],must:7,myev3:5,name:[2,3,4,5,7,10],nearli:11,necessari:[2,10],need:[2,3,4,5,7,10,11],neg:3,next:3,non:7,nonblock:7,none:4,note:[2,3,4,5,7,10,11],now:4,nreadbuff:[7,11],nreadbuffer:11,number:7,numer:[2,3,4,5,7,10,11],nwritebuff:[7,11],nwritebuffer:11,nxt:8,nxtcolor:4,nxtlight:4,nxtsound:4,nxttemperatur:4,nxttouch:4,nxtultrason:4,object:[2,3,4,5,7,10],occur:[5,7,11],off:[2,3,4,10],old:[],onc:[2,3,4,5,10,11],once:4,onli:[],only:[2,3,4,5,10],opcod:3,open:[5,7,11],opposit:3,option:[2,3,4,5,10,11],optional:[2,3,4,10],oss:7,other:[3,4],otherwis:3,output:[2,10,11],outputreadi:3,outputtest:[],packet:[2,3,5,7,10,11],pair:5,paramet:[2,3,4,5,7,10,11],part:8,pass:[3,4],path:[2,5,10],paus:[2,10],percent:[2,3,10],percentag:[2,3,10],physic:[2,3,4,10],plai:[2,10],playton:[2,10],point:3,pointer:7,poll:3,port:[2,3,4,5,6,10],posit:3,possibl:[3,4,7],potenti:5,power:[2,3,4,6,10],preced:[2,3,4,10],pretti:3,previous:3,print:[2,7,10],probabl:3,produc:7,product:[7,11],productid:[7,11],program:3,properti:[2,3,4,5,10,11],propertyname1:[5,11],propertyname2:[5,11],propertyvalue1:[5,11],propertyvalue2:[5,11],prox:4,pull:3,push:4,rais:3,random:[2,6,10],rate:4,ratio:3,raw:4,reach:3,read:[2,3,4,5,7,8,10,11],read_timeout:7,reason:3,receiv:[2,3,10],red:4,reflect:4,regul:3,regular:3,releas:3,remot:4,repli:3,report:7,reportid:7,repres:[3,4],request:3,reset:[3,4],resetposit:3,resettachocount:3,resiz:7,respect:3,respons:3,result:3,rfcomm0:[2,3,4,5,10],rfcomm1:[2,10],rfcomm2:[2,10],right:[3,4],robot:[3,8],run:3,rwth:8,same:3,second:[2,5,10],secur:3,see:[2,3,4,5,7,10,11],seek:4,seem:[2,10],send:[2,3,8,10],sensor1:[2,4,6,10],sensor2:[2,10],sensor3:[2,10],sensor4:[2,10],sensor:[],sent:[2,10],serial:[2,5,7,10],serialport:5,serport:[2,3,4,5,10],set:[2,3,4,5,7,8,10,11],setbrak:3,setnonblock:7,setproperti:[2,3,4,5,6,10,11],setup:[2,10],sever:8,share:7,sheader:7,should:[3,7,11],shown:5,signal11:7,simplifi:8,size:[7,11],slave:3,slib:7,slow:3,slower:3,slowli:3,small:[2,10],smoothli:3,smoothstart:3,smoothstop:3,some:[3,7],sometim:[],somewhat:3,sooner:[],sourc:[2,3,4,5,7,10,11],specifi:[3,4],speed:3,speedregul:3,spin:3,start:[2,3,6,8,10],state:3,statu:[2,3,10],still:3,stop:[2,3,10],stopallmotor:[2,10],stopton:[2,10],straight:3,string:[2,3,4,5,7,10],struct:7,student:8,stuff:[2,3,10],sublay:[3,4],success:7,suppos:3,sure:5,sync:3,syncedstart:3,syncedstop:3,synchron:3,syncmotor:3,syntax:[2,3,4,5,10,11],system:[5,7],tacho:3,tachocount:3,tacholimit:3,take:[3,8],test:[2,3,5,10],than:[3,7,11],them:[2,3,4,10],thi:[2,3,4,5,6,7,8,10],think:7,thoroughli:[2,10],through:[5,11],time:3,timeout:[3,5,7,11],tone:[2,10],toneplai:[2,10],too:3,toolbox:[],touch:4,tricki:3,turn:[2,3,4,10],turnratio:3,two:3,type:[2,3,4,7,10],uint16:7,uint8:[5,7,11],ultrason:4,und:3,undefin:4,unexpect:[],unexpectedli:7,unknown:4,until:3,usage:5,usbbrickio:[],use:[3,11],user:[2,10],using:7,valid:[5,7,11],valu:[2,3,4,6,7,8,10],varargin:[2,3,4,5,10,11],variou:8,vendor:[7,11],vendorid:[7,11],via:[2,3,4,5,8,10,11],view:[2,10],virtual:[2,10],voltag:[2,3,10],volum:[2,10],wai:8,waitfor:[2,3,6,10],want:8,wast:3,weird:3,what:[2,3,4,10],whatev:3,when:[2,3,4,5,7,10,11],which:[2,3,4,5,7,10,11],white:4,window:[5,7],without:[3,7],wmsg:[5,7,11],work:[2,3,4,10,11],workaround:3,would:[2,3,4,10],wrap:[],writable:[2,3,4,10],write:[5,7,11],written:[5,7,11],wrong:[2,10],www:7,xcode:7,yet:[2,10],you:[3,4,7,8,11],your:8},titles:["CommandLayer","CommunicationLayer","EV3","Motor","Sensor","btBrickIO","Examples","hidapi","MATLAB Toolbox for controlling Lego Mindstorms EV3","General","EV3","usbBrickIO"],titleterms:{bluetooth:1,btbrickio:5,command:0,commandlay:0,communicationinterfac:0,communicationlay:1,content:8,contribut:9,control:8,ev3:[2,8,10],exampl:6,gener:9,hidapi:7,installat:9,lego:8,licens:9,matlab:8,mindstorm:8,motor:3,sensor:4,toolbox:8,usb:1,usbbrickio:11}})
\ No newline at end of file
+Search.setIndex({envversion:49,filenames:["CommandLayer","CommunicationLayer","EV3","Motor","Sensor","btBrickIO","examples","hid","index","readme","source","usbBrickIO"],objects:{"":{source:[11,0,1,""]},"source.EV3":{batteryMode:[10,2,1,""],batteryValue:[10,2,1,""],beep:[10,3,1,""],connect:[10,3,1,""],debug:[10,2,1,""],disconnect:[10,3,1,""],isConnected:[10,2,1,""],motorA:[10,2,1,""],motorB:[10,2,1,""],motorC:[10,2,1,""],motorD:[10,2,1,""],playTone:[10,3,1,""],sensor1:[10,2,1,""],sensor2:[10,2,1,""],sensor3:[10,2,1,""],sensor4:[10,2,1,""],setProperties:[10,3,1,""],stopAllMotors:[10,3,1,""],stopTone:[10,3,1,""],tonePlayed:[10,3,1,""]},"source.Motor":{brakeMode:[3,2,1,""],currentSpeed:[3,2,1,""],debug:[3,2,1,""],internalReset:[3,3,1,""],isRunning:[3,2,1,""],limitMode:[3,2,1,""],limitValue:[3,2,1,""],power:[3,2,1,""],resetTachoCount:[3,3,1,""],setBrake:[3,3,1,""],setProperties:[3,3,1,""],smoothStart:[3,2,1,""],smoothStop:[3,2,1,""],speedRegulation:[3,2,1,""],start:[3,3,1,""],stop:[3,3,1,""],syncedStart:[3,3,1,""],syncedStop:[3,3,1,""],tachoCount:[3,2,1,""],type:[3,2,1,""],waitFor:[3,3,1,""]},"source.Sensor":{debug:[4,2,1,""],mode:[4,2,1,""],reset:[4,3,1,""],setProperties:[4,3,1,""],type:[4,2,1,""],value:[4,2,1,""]},"source.btBrickIO":{backend:[5,2,1,""],channel:[5,2,1,""],close:[5,3,1,""],debug:[5,2,1,""],deviceName:[5,2,1,""],open:[5,3,1,""],read:[5,3,1,""],serialPort:[5,2,1,""],setProperties:[5,3,1,""],timeOut:[5,2,1,""],write:[5,3,1,""]},"source.hidapi":{close:[7,3,1,""],enumerate:[7,3,1,""],error:[7,3,1,""],exit:[7,3,1,""],getHIDInfoString:[7,3,1,""],getManufacturersString:[7,3,1,""],getProductString:[7,3,1,""],getSerialNumberString:[7,3,1,""],handle:[7,2,1,""],init:[7,3,1,""],nReadBuffer:[7,2,1,""],nWriteBuffer:[7,2,1,""],open:[7,3,1,""],productID:[7,2,1,""],read:[7,3,1,""],read_timeout:[7,3,1,""],setNonBlocking:[7,3,1,""],sheader:[7,2,1,""],slib:[7,2,1,""],vendorID:[7,2,1,""],write:[7,3,1,""]},"source.usbBrickIO":{close:[11,3,1,""],debug:[11,2,1,""],nReadBuffer:[11,2,1,""],nWriteBuffer:[11,2,1,""],open:[11,3,1,""],productID:[11,2,1,""],read:[11,3,1,""],setProperties:[11,3,1,""],timeOut:[11,2,1,""],vendorID:[11,2,1,""],write:[11,3,1,""]},source:{EV3:[10,1,1,""],Motor:[3,1,1,""],Sensor:[4,1,1,""],btBrickIO:[5,1,1,""],hidapi:[7,1,1,""],usbBrickIO:[11,1,1,""]}},objnames:{"0":["mat","module","MATLAB module"],"1":["mat","class","MATLAB class"],"2":["mat","attribute","MATLAB attribute"],"3":["mat","method","MATLAB method"]},objtypes:{"0":"mat:module","1":"mat:class","2":"mat:attribute","3":"mat:method"},terms:{"0x0005":11,"0x694":11,"2nd":[2,3,4,10],"5000hz":[2,10],"abstract":8,"byte":[7,11],"case":[3,11],"catch":3,"char":7,"class":[2,3,4,5,7,8,10,11],"default":[4,5,7,11],"final":7,"function":[3,7],"long":3,"null":7,"return":[2,3,5,7,10,11],"throw":7,"true":[2,3,5,10,11],"try":[3,5,11],"while":8,aachen:8,abl:8,about:[2,3,4,7,10],acceler:[3,4],accelerationallax:4,access:8,accident:[2,10],act:3,action:3,actual:[3,7,11],addit:7,advanc:8,affect:3,after:[3,5,7,11],afterward:3,again:3,all:[2,3,4,7,10,11],allow:4,alreadi:7,also:[2,3,4,5,7,10,11],alternatingli:[],alwai:[7,11],ambient:4,angular:4,ani:[3,11],announc:[2,3,4,10],anoth:3,append:7,apply:3,aren:3,argument:[2,3,4,10],around:3,arrai:[5,11],automat:[2,3,4,5,7,10],avail:[4,7],backend:5,base:5,batteri:[2,10],batterymod:[2,3,10],batterymode:[2,10],batteryvalu:[2,10],been:[2,3,4,5,10],beep:[2,6,10],befor:5,behav:3,behaviour:8,besid:11,better:3,between:[3,5,7,11],bigger:[7,11],bit:3,block:7,blue:4,bool:[2,3,4,5,10,11],both:3,brake:3,brakemod:3,brakemode:3,brick:[2,3,4,5,8,10,11],brickio:[5,11],brickobject:[2,3,4,10],buffer:[7,11],buggi:[],building:[],bump:4,c_output:3,call:[2,3,4,5,7,10,11],can:[3,4,5,8],car:3,cast:7,central:[2,10],chang:3,channel:5,charg:[2,10],check:[3,7],chosen:5,clear:4,close:[5,7,11],coast:3,code:4,col:4,color:4,com:[2,10],comm:[],comment:3,commerror:7,commhandl:[5,11],commun:[3,4,7,8],compil:7,connect:[2,3,4,5,6,7,10,11],connectiontyp:[2,10],consist:[3,4],consol:[2,3,4,5,10,11],constantli:3,constructor:11,contain:[2,3,4,10],continu:3,contribut:[],control:[],conveni:[2,10],correctli:3,correspond:7,could:[5,7,11],count:3,counter:3,cours:3,creat:[2,3,4,7,10],current:[2,3,4,10],currentspe:3,data:[5,7,11],dba:4,debug:[2,3,4,5,10,11],decim:7,defin:3,degre:[3,4],delet:[2,6,7,10],deliv:[2,10],depend:[2,3,4,5,7,10],design:8,destroi:[2,10],dev:[2,3,4,5,10],develop:[7,8],devic:[3,5,7,11],devicemod:4,devicenam:5,devicename:5,devicetyp:[3,4],differ:[2,7,10],direct:3,directli:[7,8],disabl:7,disconnect:[2,10],disp:[2,6,10],distcm:4,distin:4,dll:7,document:8,documentation:[],doe:[2,3,7,10,11],doesn:[],don:[3,4],done:3,down:3,durat:[2,10],dure:7,dylib:7,each:[2,3,4,5,10,11],eas:3,easili:8,either:[2,3,10],enabl:[2,7,10,11],enumer:7,equal:[2,3,10],error:[3,4,5,7,11],establish:[2,10],even:3,eventu:11,everytim:[3,4],exampl:[],execut:3,exit:7,expect:[2,6,10],explicitli:7,extens:7,facilit:4,fals:[3,5,11],far:3,fclose:5,feedback:[2,3,4,10],file:7,finish:3,firmwar:[2,3,10],first:[2,3,10],flag:7,follow:[2,3,4,5,8,10,11],fopen:5,format:[5,11],forward:3,four:3,fread:5,frequenc:[2,10],from:[2,3,4,5,7,10,11],front:7,fun:[2,6,10],fwrite:5,gener:[],germani:8,get:[2,3,7,8,10],gethidinfostr:7,getmanufacturersstr:7,getmanufacturersstring:7,getproductstr:7,getproductstring:7,getserialnumberstr:7,getserialnumberstring:7,given:[2,3,4,7,10],glanc:[2,10],goe:3,greater:3,green:4,gyro:4,handl:7,happen:3,have:[2,3,7,10],header:7,heavi:3,henc:5,here:3,hertz:[2,10],hid:[7,11],hid_device_infoptr:7,hid_open:7,hidapi:[],hidhandl:7,high:[2,3,4,8,10],highest:3,hold:3,host:[5,7],how:3,htacceleromet:4,htcolor:4,htcompass:4,http:7,hysic:4,imag:[],immedi:[2,3,10],implement:[5,11],indic:3,individu:[3,4],infinit:3,info:7,inform:[5,7],infrare:4,init:7,input:[2,3,4,10],inputpars:[2,3,4,5,10,11],instal:[7,8],installat:[],instanc:[3,4,7],instantan:[2,10],instead:[2,3,4,10],instruct:8,instrument:5,instrumentcontrol:5,int32:7,interfac:[2,5,7,10,11],intern:3,internalreset:3,interpret:3,intuit:8,invalid:7,invalidhandl:7,isconnect:[2,10],isconnected:[2,10],isrun:3,iter:[],itself:7,keep:3,kind:3,know:7,lab:8,largemotor:4,last:3,later:[],layer:[3,4,8],lead:[],left:3,length:7,less:3,level:[2,3,4,8,10],librari:[7,11],licens:[],like:3,limit:3,limitmod:3,limitvalu:[2,3,6,10],linux:[5,7],list:[2,3,4,5,7,10,11],listen:4,load:3,look:8,loop:3,low:[2,8,10],lower:3,mac:[5,7],made:5,mai:[2,3,4,10],mainli:4,make:3,manufactur:7,mark:[2,3,4,10],master:3,matlab:[],maximum:11,mean:3,mediummotor:4,meet:8,messag:3,meth:[],method:[2,3,4,5,7,10,11],millisecond:[2,3,7,10,11],mind:3,mismatch:7,mode:[2,3,4,10],modul:5,mostli:[3,8],motor:[],motora:[2,3,4,6,10],motorb:[2,3,10],motorc:[2,10],motord:[2,10],move:3,multipl:[2,3,4,5,10,11],must:7,myev3:5,name:[2,3,4,5,7,10],nearli:11,necessari:[2,10],need:[2,3,4,5,7,10,11],neg:3,next:3,non:7,nonblock:7,none:4,note:[2,3,4,5,7,10,11],now:4,nreadbuff:[7,11],nreadbuffer:11,number:7,numer:[2,3,4,5,7,10,11],nwritebuff:[7,11],nwritebuffer:11,nxt:8,nxtcolor:4,nxtlight:4,nxtsound:4,nxttemperatur:4,nxttouch:4,nxtultrason:4,object:[2,3,4,5,7,10],occur:[5,7,11],off:[2,3,4,10],old:[],onc:[2,3,4,5,10,11],once:4,onli:[],only:[2,3,4,5,10],opcod:3,open:[5,7,11],opposit:3,option:[2,3,4,5,10,11],optional:[2,3,4,10],oss:7,other:[3,4],otherwis:3,output:[2,10,11],outputreadi:3,outputtest:[],packet:[2,3,5,7,10,11],pair:5,paramet:[2,3,4,5,7,10,11],part:8,pass:[3,4],path:[2,5,10],paus:[2,10],percent:[2,3,10],percentag:[2,3,10],physic:[2,3,4,10],plai:[2,10],playton:[2,10],point:3,pointer:7,poll:3,port:[2,3,4,5,6,10],posit:3,possibl:[3,4,7],potenti:5,power:[2,3,4,6,10],preced:[2,3,4,10],pretti:3,previous:3,print:[2,7,10],probabl:3,produc:7,product:[7,11],productid:[7,11],program:3,properti:[2,3,4,5,10,11],propertyname1:[5,11],propertyname2:[5,11],propertyvalue1:[5,11],propertyvalue2:[5,11],prox:4,pull:3,push:4,rais:3,random:[2,6,10],rate:4,ratio:3,raw:4,reach:3,read:[2,3,4,5,7,8,10,11],read_timeout:7,reason:3,receiv:[2,3,10],red:4,reflect:4,regul:3,regular:3,releas:3,remot:4,repli:3,report:7,reportid:7,repres:[3,4],request:3,reset:[3,4],resetposit:3,resettachocount:3,resiz:7,respect:3,respons:3,result:3,rfcomm0:[2,3,4,5,10],rfcomm1:[2,10],rfcomm2:[2,10],right:[3,4],robot:[3,8],run:3,rwth:8,same:3,second:[2,5,10],secur:3,see:[2,3,4,5,7,10,11],seek:4,seem:[2,10],send:[2,3,8,10],sensor1:[2,4,6,10],sensor2:[2,10],sensor3:[2,10],sensor4:[2,10],sensor:[],sent:[2,10],serial:[2,5,7,10],serialport:5,serport:[2,3,4,5,10],set:[2,3,4,5,7,8,10,11],setbrak:3,setnonblock:7,setproperti:[2,3,4,5,6,10,11],setup:[2,10],sever:8,share:7,sheader:7,should:[3,7,11],shown:5,signal11:7,simplifi:8,size:[7,11],slave:3,slib:7,slow:3,slower:3,slowli:3,small:[2,10],smoothli:3,smoothstart:3,smoothstop:3,some:[3,7],sometim:[],somewhat:3,sooner:[],sourc:[2,3,4,5,7,10,11],specifi:[3,4],speed:3,speedregul:3,spin:3,start:[2,3,6,8,10],state:3,statu:[2,3,10],still:3,stop:[2,3,10],stopallmotor:[2,10],stopton:[2,10],straight:3,string:[2,3,4,5,7,10],struct:7,student:8,stuff:[2,3,10],sublay:[3,4],success:7,suppos:3,sure:5,sync:3,syncedstart:3,syncedstop:3,synchron:3,syncmotor:3,syntax:[2,3,4,5,10,11],system:[5,7],tacho:3,tachocount:3,tacholimit:3,take:[3,8],temp:[],test:[2,3,5,10],than:[3,7,11],them:[2,3,4,10],thi:[2,3,4,5,6,7,8,10],think:7,thoroughli:[2,10],through:[5,11],time:3,timeout:[3,5,7,11],tone:[2,10],toneplai:[2,10],too:3,toolbox:[],touch:4,tricki:3,turn:[2,3,4,10],turnratio:3,two:3,type:[2,3,4,7,10],uint16:7,uint8:[5,7,11],ultrason:4,und:3,undefin:4,unexpect:[],unexpectedli:7,unknown:4,until:3,usage:5,usbbrickio:[],use:[3,11],user:[2,10],using:7,valid:[5,7,11],valu:[2,3,4,6,7,8,10],varargin:[2,3,4,5,10,11],variou:8,vendor:[7,11],vendorid:[7,11],via:[2,3,4,5,8,10,11],view:[2,10],virtual:[2,10],voltag:[2,3,10],volum:[2,10],wai:8,waitfor:[2,3,6,10],want:8,wast:3,weird:3,what:[2,3,4,10],whatev:3,when:[2,3,4,5,7,10,11],which:[2,3,4,5,7,10,11],white:4,window:[5,7],without:[3,7],wmsg:[5,7,11],work:[2,3,4,10,11],workaround:3,would:[2,3,4,10],wrap:[],writable:[2,3,4,10],write:[5,7,11],written:[5,7,11],wrong:[2,10],www:7,xcode:7,yet:[2,10],you:[3,4,7,8,11],your:8},titles:["CommandLayer","CommunicationLayer","EV3","Motor","Sensor","btBrickIO","Examples","hidapi","MATLAB Toolbox for controlling Lego Mindstorms EV3","General","EV3","usbBrickIO"],titleterms:{bluetooth:1,btbrickio:5,command:0,commandlay:0,communicationinterfac:0,communicationlay:1,content:8,contribut:9,control:8,ev3:[2,8,10],exampl:6,gener:9,hidapi:7,installat:9,lego:8,licens:9,matlab:8,mindstorm:8,motor:3,sensor:4,toolbox:8,usb:1,usbbrickio:11}})
\ No newline at end of file
diff --git a/docs/_build/html/source.html b/docs/_build/html/source.html
index a7242b2703e37e4c595d58e4801b4e9d7f8afd92..375b9f9e271c42b12600e7cdd9d5c1e7b9cd9558 100644
--- a/docs/_build/html/source.html
+++ b/docs/_build/html/source.html
@@ -136,20 +136,24 @@
 <dl class="class">
 <dt id="source.EV3">
 <em class="property">class </em><code class="descclassname">source.</code><code class="descname">EV3</code><span class="sig-paren">(</span><em>varargin</em><span class="sig-paren">)</span><a class="headerlink" href="#source.EV3" title="Permalink to this definition">¶</a></dt>
-<dd><p>High-level class to work with physical bricks.</p>
-<p>This is the &#8216;central&#8217; class (from user&#8217;s view) when working with this toolbox. It
-delivers a convenient interface for creating a connection to the brick and sending
-commands to it. An EV3-object creates 4 Motor- and 4 Sensor-objects, one for each port.</p>
-<blockquote>
-<div><ul class="simple">
-<li><a class="reference internal" href="#source.EV3.setProperties" title="source.EV3.setProperties"><code class="xref mat mat-meth docutils literal"><span class="pre">setProperties()</span></code></a></li>
-<li><a class="reference internal" href="#source.EV3.beep" title="source.EV3.beep"><code class="xref mat mat-meth docutils literal"><span class="pre">beep()</span></code></a></li>
+<dd><dl class="docutils">
+<dt><em>List of methods</em>:</dt>
+<dd><ul class="first last simple">
+<li><a class="reference internal" href="#source.EV3.connect" title="source.EV3.connect"><code class="xref mat mat-meth docutils literal"><span class="pre">connect()</span></code></a></li>
+<li><a class="reference internal" href="#source.EV3.disconnect" title="source.EV3.disconnect"><code class="xref mat mat-meth docutils literal"><span class="pre">disconnect()</span></code></a></li>
 <li><a class="reference internal" href="#source.EV3.stopAllMotors" title="source.EV3.stopAllMotors"><code class="xref mat mat-meth docutils literal"><span class="pre">stopAllMotors()</span></code></a></li>
+<li><a class="reference internal" href="#source.EV3.beep" title="source.EV3.beep"><code class="xref mat mat-meth docutils literal"><span class="pre">beep()</span></code></a></li>
 <li><a class="reference internal" href="#source.EV3.playTone" title="source.EV3.playTone"><code class="xref mat mat-meth docutils literal"><span class="pre">playTone()</span></code></a></li>
 <li><a class="reference internal" href="#source.EV3.stopTone" title="source.EV3.stopTone"><code class="xref mat mat-meth docutils literal"><span class="pre">stopTone()</span></code></a></li>
 <li><a class="reference internal" href="#source.EV3.tonePlayed" title="source.EV3.tonePlayed"><code class="xref mat mat-meth docutils literal"><span class="pre">tonePlayed()</span></code></a></li>
+<li><a class="reference internal" href="#source.EV3.setProperties" title="source.EV3.setProperties"><code class="xref mat mat-meth docutils literal"><span class="pre">setProperties()</span></code></a></li>
 </ul>
-</div></blockquote>
+</dd>
+</dl>
+<p>High-level class to work with physical bricks.</p>
+<p>This is the &#8216;central&#8217; class (from user&#8217;s view) when working with this toolbox. It
+delivers a convenient interface for creating a connection to the brick and sending
+commands to it. An EV3-object creates 4 Motor- and 4 Sensor-objects, one for each port.</p>
 <p class="rubric">Notes</p>
 <ul class="simple">
 <li>Creating multiple EV3 objects and connecting them to different physical bricks has not
diff --git a/docs/_build/html/usbBrickIO.html b/docs/_build/html/usbBrickIO.html
index 9c62c7b092f2265c34a38b09a33cec1a6feaa7a4..c539f81b082f9eab9f2803b1becabf8ae97ec64f 100644
--- a/docs/_build/html/usbBrickIO.html
+++ b/docs/_build/html/usbBrickIO.html
@@ -146,7 +146,18 @@
 <dl class="class">
 <dt id="source.usbBrickIO">
 <em class="property">class </em><code class="descname">usbBrickIO</code><span class="sig-paren">(</span><em>varargin</em><span class="sig-paren">)</span><a class="headerlink" href="#source.usbBrickIO" title="Permalink to this definition">¶</a></dt>
-<dd><p>USB interface between MATLAB and the brick</p>
+<dd><dl class="docutils">
+<dt><em>List of methods</em>:</dt>
+<dd><ul class="first last simple">
+<li><a class="reference internal" href="#source.usbBrickIO.open" title="source.usbBrickIO.open"><code class="xref mat mat-meth docutils literal"><span class="pre">open()</span></code></a></li>
+<li><a class="reference internal" href="#source.usbBrickIO.close" title="source.usbBrickIO.close"><code class="xref mat mat-meth docutils literal"><span class="pre">close()</span></code></a></li>
+<li><a class="reference internal" href="#source.usbBrickIO.read" title="source.usbBrickIO.read"><code class="xref mat mat-meth docutils literal"><span class="pre">read()</span></code></a></li>
+<li><a class="reference internal" href="#source.usbBrickIO.write" title="source.usbBrickIO.write"><code class="xref mat mat-meth docutils literal"><span class="pre">write()</span></code></a></li>
+<li><a class="reference internal" href="#source.usbBrickIO.setProperties" title="source.usbBrickIO.setProperties"><code class="xref mat mat-meth docutils literal"><span class="pre">setProperties()</span></code></a></li>
+</ul>
+</dd>
+</dl>
+<p>USB interface between MATLAB and the brick</p>
 <p class="rubric">Notes</p>
 <ul class="simple">
 <li>Uses the hid library implementation in hidapi.m</li>
diff --git a/docs/process.py b/docs/process.py
index 81906775b823fa91371e45fe2fcd14e784d48f07..4fce539f057bf2490aef3b199b8e5dd53346b36e 100644
--- a/docs/process.py
+++ b/docs/process.py
@@ -5,9 +5,14 @@ from os import close, remove
 from tempfile import mkstemp
 from shutil import move
 
+TMP_FILE_STR = '%TEMP-FILE FOR BUILDING DOCUMENTATION'
+
 def preprocess():
     """Preprocesses data for building documentation
 
+    Prerequisites: Has to be inside toolboxFile/docs.
+
+    TODO: Fixes the following bugs: ...
     The MATLAB Sphinx extension takes veeery (or even infinitely?) long
     to build the documentation if a class contains an enumeration.
     """
@@ -15,6 +20,8 @@ def preprocess():
     code_dir = os.path.abspath('../source')
     files = _matlab_files(os.listdir(code_dir))
 
+    documented_methods = _find_documented_methods()
+
     n_files = len(files)
     for n, file_name in enumerate(files):
         # print("Preprocessing file {0} [{1}|{2}]".format(file_name, n+1, n_files))
@@ -28,19 +35,41 @@ def preprocess():
 
                     try:
                         for i, line in enumerate(content):  # Worst runtime ever
-                            if _ignore_line(line) is False and 'enumeration' in line:
-                                ftemp.write('%TEMP-FILE FOR BUILDING DOCUMENTATION\n')
-                                _write_lines(content[:i], ftemp)
-                                for j, enum_line in enumerate(content[i:]):
-                                   ftemp.write(" %"+enum_line)
-                                   if " end" in enum_line or "end\n" == enum_line:
-                                        _write_lines(content[i+1+j:], ftemp)
-                                        close(fh)
-                                        remove(code_dir + "/" + file_name)
-                                        move(abs_path, code_dir + "/" + file_name)
-                                        # At this point, entire file has been processed: continue outer loop
-                                        # Hackily implemented by raising an exception
-                                        raise StopIteration
+                            if _ignore_line(line) is False:
+                                if 'classdef' in line:
+                                    class_name = line.replace(' ', '').split('%')[0].split('<')[0].split('classdef')[1]
+                                    try:
+                                        methods = documented_methods[class_name]
+
+                                        line = line.replace('\n', '') + '  %TEMP-FILE FOR BUILDING DOCUMENTATION\n'
+
+                                        _write_lines(content[:i], ftemp)
+                                        _write_lines([line], ftemp)
+                                        _write_lines(_method_lines(methods), ftemp)
+                                        _write_lines(content[i+1:], ftemp)
+
+                                    except KeyError:
+                                        ignore_class = True
+                                        continue
+
+                                    close(fh)
+                                    remove(code_dir + "/" + file_name)
+                                    move(abs_path, code_dir + "/" + file_name)
+
+                                    raise StopIteration
+                                elif 'enumeration' in line:
+                                    ftemp.write('%TEMP-FILE FOR BUILDING DOCUMENTATION\n')
+                                    _write_lines(content[:i], ftemp)
+                                    for j, enum_line in enumerate(content[i:]):
+                                        ftemp.write(" %"+enum_line)
+                                        if " end" in enum_line or "end\n" == enum_line:
+                                            _write_lines(content[i+1+j:], ftemp)
+                                            close(fh)
+                                            remove(code_dir + "/" + file_name)
+                                            move(abs_path, code_dir + "/" + file_name)
+                                            # At this point, entire file has been processed: continue outer loop
+                                            # Hackily implemented by raising an exception
+                                            raise StopIteration
                     except StopIteration:
                         continue
         except IOError:
@@ -50,6 +79,8 @@ def postprocess():
     code_dir = os.path.abspath('../source')
     files = _matlab_files(os.listdir(code_dir))
 
+    documented_methods = _find_documented_methods()
+
     n_files = len(files)
     for n, file_name in enumerate(files):
         # print("Postprocessing file {0} [{1}|{2}]".format(file_name, n+1, n_files))
@@ -58,11 +89,32 @@ def postprocess():
             with open(code_dir + "/" + file_name, 'r') as f:
                 with open(abs_path, 'w') as ftemp:
                     content = f.readlines()
-                    if content[0] != '%TEMP-FILE FOR BUILDING DOCUMENTATION\n':
-                        continue
+                    #if content[0] != '%TEMP-FILE FOR BUILDING DOCUMENTATION\n':
+                    #    continue
                     try:
                         for i, line in enumerate(content):  # Worst runtime ever
-                            if 'enumeration' in line:
+                            if 'classdef' in line and '%TEMP-FILE FOR BUILDING DOCUMENTATION' in line:
+                                class_name = line.replace(' ', '').split('%')[0].split('<')[0].split('classdef')[1]
+                                print(class_name)
+                                try:
+                                    n_methods = len(documented_methods[class_name])
+
+                                    line = line.replace(TMP_FILE_STR, '')
+
+                                    _write_lines(content[:i], ftemp)
+                                    _write_lines([line], ftemp)
+                                    _write_lines(content[i+n_methods+5:], ftemp)
+
+                                except KeyError:
+                                    ignore_class = True
+                                    continue
+
+                                close(fh)
+                                remove(code_dir + "/" + file_name)
+                                move(abs_path, code_dir + "/" + file_name)
+
+                                raise StopIteration
+                            elif 'enumeration' in line:
                                 _write_lines(content[1:i], ftemp)
                                 for j, enum_line in enumerate(content[i:]):
                                    ftemp.write(enum_line.replace(' %', '', 1))
@@ -124,3 +176,38 @@ def _write_lines(lines, f):
 
 def _matlab_files(files) -> list:
     return [f for f in files if (f.endswith(".m") and "_" not in f and "proto" not in f)]
+
+def _rst_files(files) -> list:
+    return [f for f in files if f.endswith(".rst")]
+
+def _method_lines(methods) -> list:
+    doc_lines = ['    %\n']
+    doc_lines.append('    % *List of methods*:\n')
+    for method in methods:
+        doc_lines.append('    %             * :meth:`' + method + '`\n')
+    doc_lines.append('    %\n')
+    doc_lines.append('    %\n')
+
+    return doc_lines
+
+def _find_documented_methods():
+    files = _rst_files(os.listdir(os.path.abspath('.')))
+
+    doc_methods = {}
+    for file_name in files:
+        with open(file_name) as f:
+            content = f.readlines()
+            class_name = ''
+
+            for i, line in enumerate(content):
+                class_string = '.. autoclass:: '
+                if class_name != '':
+                    if ':members:' in line:  # Found line with method names
+                        method_names = line.split(':members: ')[1].split(', ')
+                        method_names = [m.replace('\n', '') for m in method_names[:]]
+                        doc_methods[class_name] = method_names
+
+                if class_string in line:
+                    class_name = line.split(class_string)[1].replace('\n', '')
+
+    return doc_methods
diff --git a/source/EV3.m b/source/EV3.m
old mode 100755
new mode 100644
index 53abefb3b35fef18261fedc337d1b39cae479bd0..610693e852f655a5e09a9fca81926d7b296d5faa
--- a/source/EV3.m
+++ b/source/EV3.m
@@ -1,18 +1,19 @@
-classdef EV3 < MaskedHandle
+classdef EV3 < MaskedHandle      
     % High-level class to work with physical bricks.
     %
     % This is the 'central' class (from user's view) when working with this toolbox. It
     % delivers a convenient interface for creating a connection to the brick and sending
     % commands to it. An EV3-object creates 4 Motor- and 4 Sensor-objects, one for each port.
-    % 
+    %
+    %
     % Notes:
     %     * Creating multiple EV3 objects and connecting them to different physical bricks has not
     %       been thoroughly tested yet, but seems to work on a first glance.
-    %     * When an input argument of a method is marked as optional, the argument needs to be 
-    %       'announced' by a preceding 2nd argument, which is a string containing the name of the argument. 
+    %     * When an input argument of a method is marked as optional, the argument needs to be
+    %       'announced' by a preceding 2nd argument, which is a string containing the name of the argument.
     %       For example, Motor.setProperties may be given a power-parameter. The syntax would be as
     %       follows: *brickObject.motorA.setProperties('power', 50);*
-    %       
+    %
     %
     %
     % Attributes:
@@ -37,42 +38,42 @@ classdef EV3 < MaskedHandle
     %
     % Example:
     %     % This example expects a motor at port A and a (random) sensor at port 1 |br|
-    %     b = EV3(); % |br| 
-    %     b.connect('usb'); % |br|   
+    %     b = EV3(); % |br|
+    %     b.connect('usb'); % |br|
     %     ma = b.motorA; % |br|
     %     ma.setProperties('power', 50, 'limitValue', 720); % |br|
-    %     ma.start(); % |br|  
+    %     ma.start(); % |br|
     %     % fun |br|
     %     ma.waitFor(); % |br|
     %     disp(b.sensor1.value); % |br|
     %     b.beep(); % |br|
     %     delete b; % |br|
-    
+
     properties
         % batteryMode (string in {'Percentage', 'Voltage'}): Mode for reading battery charge. [WRITABLE]
         % See also BATTERYVALUE
         batteryMode;
-        
+
         % debug (numeric in {0,1,2}): Debug mode. [WRITABLE]
         %     - 0: Debug turned off
-        %     - 1: (High-level-) Debug turned on for EV3-object - enables feedback in the 
+        %     - 1: (High-level-) Debug turned on for EV3-object - enables feedback in the
         %          console about what firmware-commands have been called when using a method
         %     - 2: Low-level-Debug turned on - each packet sent and received is printed to the
         %          console
-        debug; 
+        debug;
     end
 
     properties (Dependent)  % Parameters to be read directly from physical brick
         % batteryValue (numeric): Current battery charge. Depending on batteryMode, the reading
         %     is either in percentage or voltage. [READ-ONLY]
         % See also BATTERYMODE
-        batteryValue; 
+        batteryValue;
     end
-    
+
     properties (SetAccess = private)  % Read-only properties that are set internally
         % isConnected (bool): True if virtual brick-object is connected to physical one. [READ-ONLY]
-        isConnected = false; 
-        
+        isConnected = false;
+
         % motorA (Motor): Motor-object interfacing port A.
         % See also MOTOR
         motorA;
@@ -85,7 +86,7 @@ classdef EV3 < MaskedHandle
         % motorD (Motor): Motor-object interfacing port D.
         % See also MOTOR
         motorD;
-        
+
         % sensor1 (Sensor): Sensor-object interfacing port 1.
         % See also SENSOR
         sensor1;
@@ -97,21 +98,21 @@ classdef EV3 < MaskedHandle
         sensor3;
         % sensor4 (Sensor): Sensor-object interfacing port 4.
         % See also SENSOR
-        sensor4;            
+        sensor4;
     end
-    
+
     properties (Access = private)
         % commInterface (CommunicationInterface): Interface to communication layer
         %     All commands sent to the Brick are created and written through this object. Each
         %     Motor- and Sensor-object has a reference to it.
         commInterface = 0;
     end
-    
+
     properties (Hidden, Access = private)  % Hidden properties for internal use only
         % init (bool): Indicates init-phase (i.e. constructor is running).
         init = true;
     end
-    
+
     methods  % Standard methods
         %% Constructor
         function ev3 = EV3(varargin)
@@ -122,38 +123,38 @@ classdef EV3 < MaskedHandle
             %     varargin: see setProperties(ev3, varargin).
             %
             % See also SETPROPERTIES / :meth:`setProperties(ev3, varargin)`
-            
+
             ev3.setProperties(varargin{:});
-            
+
             ev3.motorA = Motor('A', 'Debug', ev3.debug>0);
             ev3.motorB = Motor('B', 'Debug', ev3.debug>0);
             ev3.motorC = Motor('C', 'Debug', ev3.debug>0);
             ev3.motorD = Motor('D', 'Debug', ev3.debug>0);
-            
-            
+
+
             ev3.sensor1 = Sensor('1', 'Debug', ev3.debug>0);
             ev3.sensor2 = Sensor('2', 'Debug', ev3.debug>0);
             ev3.sensor3 = Sensor('3', 'Debug', ev3.debug>0);
             ev3.sensor4 = Sensor('4', 'Debug', ev3.debug>0);
-            
+
             ev3.init = false;
         end
-        
+
         function delete(ev3)
             % Disconnects from physical brick and deletes this instance.
-            
+
             if ev3.isConnected
                 ev3.disconnect();
             end
         end
-        
-        %% Connection 
+
+        %% Connection
         function connect(ev3, varargin)
             % Connects EV3-object and its Motors and Sensors to physical brick.
             %
             % Arguments:
             %     connectionType (string in {'bt', 'usb'}): Connection type
-            %     serPort (string in {'/dev/rfcomm1', '/dev/rfcomm2', ...}): Path to serial port 
+            %     serPort (string in {'/dev/rfcomm1', '/dev/rfcomm2', ...}): Path to serial port
             %         (necessary if connectionType is 'bt'). *[OPTIONAL]*
             %     beep (bool): If true, EV3 beeps if connection has been established. *[OPTIONAL]*
             %
@@ -163,10 +164,10 @@ classdef EV3 < MaskedHandle
             %     b.connect('bt', 'serPort', '/dev/rfcomm0'); % |br|
             %     % Setup usb connection, beep when connection has been established
             %     b = EV3(); % |br|
-            %     b.connect('usb', 'beep', 'on', ); % |br| 
-            %     
+            %     b.connect('usb', 'beep', 'on', ); % |br|
+            %
             % See also ISCONNECTED / :attr:`isConnected`
-            
+
             if ev3.isConnected
                 if isCommInterfaceValid(ev3.commInterface)
                     error('EV3::connect: Already connected.');
@@ -174,16 +175,16 @@ classdef EV3 < MaskedHandle
                     warning(['EV3::connect: EV3.isConnected is set to ''True'', but ',...
                              'comm handle is invalid. Deleting invalid handle and ' ,...
                              'resetting EV3.isConnected now...']);
-                         
+
                     ev3.commInterface = 0;
                     ev3.isConnected = false;
                 end
             end
-            
+
             if nargin < 2
                  error('EV3::connect: Wrong number of input arguments.');
             end
-            
+
             idxes = strcmpi('beep', varargin);
             idx = find([0, idxes(1:end-1)]);
             if ~isempty(idx)
@@ -194,24 +195,24 @@ classdef EV3 < MaskedHandle
             else
                 beep = false;
             end
-            
+
             % Try to connect
-            try 
+            try
                 % Connect to physical brick
                 % -> Creating communication-handle implicitly establishes connection
                 ev3.commInterface = CommunicationInterface(varargin{:}, 'debug', ev3.debug>=2);
                 ev3.isConnected = true;
-                
+
                 if beep
                     ev3.beep();
                 end
-                
+
                 % Connect motors
                 ev3.motorA.connect(ev3.commInterface);
                 ev3.motorB.connect(ev3.commInterface);
                 ev3.motorC.connect(ev3.commInterface);
                 ev3.motorD.connect(ev3.commInterface);
-                
+
                 % Connect sensors
                 ev3.sensor1.connect(ev3.commInterface);
                 ev3.sensor2.connect(ev3.commInterface);
@@ -224,11 +225,11 @@ classdef EV3 < MaskedHandle
                     ev3.commInterface.delete();
                     ev3.commInterface = 0;
                 end
-                
+
                 rethrow(ME);
             end
         end
-        
+
         function disconnect(ev3)
             % Disconnects EV3-object and its Motors and Sensors from physical brick.
             %
@@ -240,42 +241,42 @@ classdef EV3 < MaskedHandle
             %     b.connect('bt', 'serPort', '/dev/rfcomm0'); % |br|
             %     % do stuff |br|
             %     b.disconnect(); % |br|
-            
+
             ev3.resetPhysicalBrick();
-            
+
             % Disconnect motors and sensors
             % -> set references to comm handle to 0
             ev3.motorA.disconnect();
             ev3.motorB.disconnect();
             ev3.motorC.disconnect();
             ev3.motorD.disconnect();
-            
+
             ev3.sensor1.disconnect();
             ev3.sensor2.disconnect();
             ev3.sensor3.disconnect();
             ev3.sensor4.disconnect();
-            
+
             % Delete handle to comm-interface
             if isCommInterfaceValid(ev3.commInterface) && ev3.commInterface ~= 0
                 ev3.commInterface.delete();
             end
             ev3.commInterface = 0;
-            
+
             ev3.isConnected = false;
         end
-        
+
         %% Device functions
         function stopAllMotors(ev3)
             % Sends a stop-command to all motor-ports.
-            
+
             if ~ev3.isConnected
                 error(['EV3::stopAllMotors: Brick-Object not connected physical brick. ',...
                        'You have to call ev3.connect(...) first!']);
             end
-            
+
             ev3.commInterface.outputStopAll();
         end
-        
+
         %% Sound functions
         function beep(ev3)
             % Plays a 'beep'-tone on brick.
@@ -288,19 +289,19 @@ classdef EV3 < MaskedHandle
             %     b.connect('bt', 'serPort', '/dev/rfcomm0'); % |br|
             %     b.beep(); % |br|
             %
-            
+
             if ~ev3.isConnected
                 error(['EV3::beep: Brick-Object not connected physical brick. ',...
                        'You have to call ev3.connect(...) first!']);
             end
-            
+
             ev3.commInterface.soundPlayTone(10, 1000, 100);
-            
+
             if ev3.debug
 				fprintf('(DEBUG) EV3::beep: Sent ''soundPlayTone''-command\n');
             end
         end
-        
+
         function playTone(ev3, volume, frequency, duration)
             % Plays tone on brick.
             %
@@ -310,24 +311,24 @@ classdef EV3 < MaskedHandle
             %     duration (numeric > 0): in milliseconds
             %
             % Example:
-            %     b = EV3(); % |br| 
+            %     b = EV3(); % |br|
             %     b.connect('bt', 'serPort', '/dev/rfcomm0'); % |br|
             %     b.playTone(40, 5000, 1000);  % Plays tone with 40% volume and 5000Hz for 1
             %     second. |br|
             %
-            
+
             if ~ev3.isConnected
                 error(['EV3::isConnected: Brick-Object not connected physical brick. ',...
                        'You have to call ev3.connect(...) first!']);
             end
-            
+
             ev3.commInterface.soundPlayTone(volume, frequency, duration);
-            
+
             if ev3.debug
 				fprintf('(DEBUG) EV3::playTone: Sent ''soundPlayTone''-command\n');
             end
         end
-        
+
         function stopTone(ev3)
             % Stops tone currently played.
             %
@@ -337,25 +338,25 @@ classdef EV3 < MaskedHandle
             %     b.playTone(10,100,100000000);  % Accidentally given wrong tone duration :) |br|
             %     b.stopTone();  % Stops tone immediately. |br|
             %
-            
+
             if ~ev3.isConnected
                 error(['EV3::stopTone: Brick-Object not connected physical brick. ',...
                        'You have to call ev3.connect(...) first!']);
             end
-            
+
             ev3.commInterface.soundStopTone();
-            
+
             if ev3.debug
 				fprintf('(DEBUG) EV3::stopTone: Called ''soundStopTone''-command\n');
             end
         end
-        
+
         function status = tonePlayed(ev3)
             % Tests if tone is currently played.
             %
-            % Returns:  
+            % Returns:
             %     status (bool): True if a tone is being played
-            %            
+            %
             % Example
             %     b = EV3(); % |br|
             %     b.connect('bt', 'serPort', '/dev/rfcomm0'); % |br|
@@ -363,59 +364,59 @@ classdef EV3 < MaskedHandle
             %     pause(0.5); % Small pause is necessary as tone does not start instantaneously |br|
             %     b.tonePlayed(); % -> Outputs 1 to console.  |br|
             %
-            
+
             if ~ev3.isConnected
                 error(['EV3::tonePlayed: Brick-Object not connected physical brick. ',...
                        'You have to call ev3.connect(...) first!']);
             end
-            
+
             status = ev3.commInterface.soundTest;
-            
+
             if ev3.debug
 				fprintf('(DEBUG) EV3::tonePlayed: Called ''soundTest''-command\n');
             end
         end
-        
+
         %% Setter
         function set.commInterface(ev3, comm)
             if ~isCommInterfaceValid(comm)
                 error('EV3::set.commInterface: Handle to Brick-object not valid.');
             end
-            
+
             ev3.commInterface = comm;
         end
-        
+
         function set.batteryMode(ev3, batteryMode)
             validModes = {'Voltage', 'Percentage'};
             if ~ischar(batteryMode) || ~ismember(batteryMode, validModes)
                 error('EV3::set.batteryMode: Given parameter is not a valid battery mode.');
             end
-            
+
             ev3.batteryMode = batteryMode;
         end
-        
+
         function set.debug(ev3, debug)
             if ~isBool(debug) && debug ~= 2
                 error('EV3::set.debug: Given parameter is not a bool.');
             end
-            
+
             ev3.debug = str2bool(debug);
-            
+
             if ev3.isConnected
-                ev3.commInterface.debug = (ev3.debug >= 2); 
+                ev3.commInterface.debug = (ev3.debug >= 2);
             end
-            
+
             ev3.motorA.debug = (ev3.debug > 0);
             ev3.motorB.debug = (ev3.debug > 0);
             ev3.motorC.debug = (ev3.debug > 0);
             ev3.motorD.debug = (ev3.debug > 0);
-            
+
             ev3.sensor1.debug = (ev3.debug > 0);
             ev3.sensor2.debug = (ev3.debug > 0);
             ev3.sensor3.debug = (ev3.debug > 0);
             ev3.sensor4.debug = (ev3.debug > 0);
         end
-        
+
         function setProperties(ev3, varargin)
             % Set multiple EV3 properties at once using MATLAB's inputParser.
             %
@@ -430,9 +431,9 @@ classdef EV3 < MaskedHandle
             %     % Instead of: b.debug = 'on'; b.batteryMode = 'Voltage'; % |br|
             %
             % See also EV3.DEBUG, EV3.BATTERYMODE / :attr:`debug`, :attr:`batteryMode`
-            
+
             p = inputParser();
-            
+
             % Set default values
             if ev3.init
                 defaultDebug = false;
@@ -441,43 +442,43 @@ classdef EV3 < MaskedHandle
                 defaultDebug = ev3.debug;
                 defaultBatteryMode = ev3.batteryMode;
             end
-            
+
             % Add parameter
             p.addOptional('debug', defaultDebug);
             p.addOptional('batteryMode', defaultBatteryMode);
-            
+
             % Parse...
             p.parse(varargin{:});
-            
+
             % Set properties
             ev3.batteryMode = p.Results.batteryMode;
             ev3.debug = p.Results.debug;
         end
-        
+
         %% Getter
         function bat = get.batteryValue(ev3)
             if ~ev3.isConnected
                 warning(ID('noConnection'), 'EV3::getBattery: EV3-Object not connected to physical EV3.');
-                
+
                 bat = 0;
                 return;
             end
-            
+
             bat = ev3.getBattery();
         end
-        
+
         function display(ev3)
             % Displays EV3-properties and its devices.
-            
-            displayProperties(ev3); 
-            
+
+            displayProperties(ev3);
+
             fprintf('\n\tDevices\n');
             props = properties(ev3);
-            
+
             warning('off', 'all');  % Turn off warnings while reading values
             for i = 1:length(props)
                 p = props{i};
-                
+
                 if strcmp(class(ev3.(p)),'Sensor') || strcmp(class(ev3.(p)), 'Motor')
                     fprintf('\t%15s [Type: %s]\n', p, char(ev3.(p).type));
                 end
@@ -485,26 +486,26 @@ classdef EV3 < MaskedHandle
             warning('on', 'all');
         end
     end
-    
+
     methods (Access = private)  % Private brick functions that are wrapped by dependent params
         function bat = getBattery(ev3)
             % Retrieve batteryValue from brick in current mode. (Wrapped by EV3.batteryValue)
-            
+
             if strcmpi(ev3.batteryMode, 'Percentage')
                 bat = ev3.commInterface.uiReadLbatt();
-                
+
                 if ev3.debug
                     fprintf('(DEBUG) EV3::getBattery: Called ''uiReadLBatt''-command\n');
                 end
             else
                 bat = ev3.commInterface.uiReadVbatt();
-                
+
                 if ev3.debug
                     fprintf('(DEBUG) EV3::getBattery: Called ''uiReadVBatt''-command\n');
                 end
             end
         end
-        
+
         function resetPhysicalBrick(ev3)
             % Resets Motors and Sensors.
             %
@@ -512,10 +513,10 @@ classdef EV3 < MaskedHandle
             %     * Gets called automatically by EV3.delete.
             %
             % See also MOTOR.RESETPHYSICALMOTOR, SENSOR.RESETPHYSICALSENSOR
-            
+
             sensors = {'sensor1', 'sensor2', 'sensor3', 'sensor4'};
             motors = {'motorA', 'motorB', 'motorC', 'motorD'};
-            
+
             for i = 1:4
                 motor = motors{i};
                 sensor = sensors{i};
@@ -524,4 +525,4 @@ classdef EV3 < MaskedHandle
             end
         end
     end
-end 
+end
diff --git a/source/Motor.m b/source/Motor.m
old mode 100755
new mode 100644
index 62fb6bcef6d6bbcfdc1f3a78deecc2ea44301883..b9887d67297fc49dbc69cb8316bda253072267c7
--- a/source/Motor.m
+++ b/source/Motor.m
@@ -1,4 +1,4 @@
-classdef Motor < MaskedHandle & dynamicprops
+classdef Motor < MaskedHandle & dynamicprops      
     % High-level class to work with motors.
     %
     % This class is supposed to ease the use of the brick's motors. It is possible to set all
diff --git a/source/Sensor.m b/source/Sensor.m
old mode 100755
new mode 100644
index 2cd6ec2c8e91cce616356f53673431c0e64439a1..f89b80f8c8460d1e3c1e6031ab8c469fc5bbc1e8
--- a/source/Sensor.m
+++ b/source/Sensor.m
@@ -1,4 +1,4 @@
-classdef Sensor < MaskedHandle
+classdef Sensor < MaskedHandle      
     % High-level class to work with sensors.
     % 
     % The Sensor-class facilitates the communication with sensors. This mainly consists of 
diff --git a/source/btBrickIO.m b/source/btBrickIO.m
old mode 100755
new mode 100644
index fb250d06c3eb8c375140590c67c3a54a0fcbca2c..ea8ed4c4ad291c3820e84829b1c462fbda562353
--- a/source/btBrickIO.m
+++ b/source/btBrickIO.m
@@ -1,305 +1,305 @@
-classdef btBrickIO < BrickIO
-    % Bluetooth interface between MATLAB and the brick
-    %
-    % Notes:
-    %     * Connects to the bluetooth module on the host through a serial
-    %       connection. Hence be sure that a serial connection to the bluetooth
-    %       module can be made. Also be sure that the bluetooth module has been paired
-    %       to the brick before trying to connect.
-    %     * Usage is OS-dependent:
-    %           * Windows: the deviceName- & channel-properties are needed for connection. The implementation is based on the Instrument Control toolbox.
-    %           * Linux (and potentially Mac): serialPort-property is needed for connection. The implementation is based on MATLAB's serial port implementation.
-    %
-    %     * For general information, see also :class:`BrickIO`.
-    %
-    % Attributes:
-    %     debug (bool): If true, each open/close/read/write-call will be shown in the console.
-    %        Defaults to false.
-    %     serialPort (string): Path to the serial-port object. Only needed when using MATLAB's 
-    %        serial class (i.e. on linux/mac). Defaults to '/dev/rfcomm0'.
-    %     deviceName (string):  Name of the BT-device = the brick. Only needed when using the 
-    %        Instrument Control toolbox (i.e. on windows). Defaults to 'EV3'.
-    %     channel (numeric > 0): BT-channel of the connected BT-device. Only needed when using 
-    %        the Instrument Control toolbox (i.e. on windows). Defaults to 1.
-    %     timeOut (numeric >= 0): seconds after which a timeout-error occurs if no packet could be
-    %        read. Defaults to 10.
-    %     backend ('serial'|'instrumentControl'): Backend this implementation is based on. Is
-    %        automatically chosen depending on the OS. Defaults to 'serial' on linux/mac
-    %        systems, and to 'instrumentControl' on windows systems.
-    %
-    % 
-    % Examples:
-    %     % Connecting on windows |br|
-    %     commHandle = btBrickIO('deviceName', 'MyEV3', 'channel', 1); % |br| 
-    %     % Connecting on windows using MATLABs default serial port implementation for testing |br|
-    %     commHandle = btBrickIO('deviceName', 'MyEV3', 'channel', 1, 'backend', 'serial'); % |br|
-    %     % Connecting on mac/linux |br|
-    %     commHandle = btBrickIO('serPort', '/dev/rfcomm0'); % |br| 
-    %
-    
-    properties
-        % debug (bool): If true, each open/close/read/write-call will be noted in the console.
-        %     Defaults to false.
-        debug;
-        % serialPort (string): Path to the serial-port object. Defaults to '/dev/rfcomm0'.
-        %     Only needed when using MATLAB's serial class (i.e. on linux/mac). 
-        serialPort;
-        % deviceName (string):  Name of the BT-device = the brick. Defaults to 'EV3'.
-        %     Only needed when using the Instrument Control toolbox (i.e. on windows). 
-        deviceName;
-        % channel (numeric > 0): BT-channel of the connected BT-device. Defaults to 1.
-        %     Only needed when using the Instrument Control toolbox (i.e. on windows). 
-        channel;
-        % timeOut (numeric > 0): Seconds after which a timeout-error occurs if no packet could be read. 
-        %     Defaults to 10.
-        timeOut;
-        % backend ('serial'|'instrumentControl'): Backend this implementation is based on. 
-        %     Is automatically chosen depending on the OS. Defaults to 'serial' on linux/mac
-        %     systems, and to 'instrumentControl' on windows systems.
-        backend;
-    end
-    
-    properties (Access = protected)
-        % handle: Connection handle to the device
-        handle;
-    end 
-    
-    methods
-        function brickIO = btBrickIO(varargin)
-            % Create a btBrickIO object
-            %
-            % Arguments:
-            %     varargin: Any number of property names as strings, each followed by the
-            %         desired value. 
-            % 
-            % Examples: 
-            %     % Connecting on windows
-            %     commHandle = btBrickIO('deviceName', 'MyEV3', 'channel', 1); 
-            %     % Connecting on windows using MATLABs default serial port implementation for testing
-            %     commHandle = btBrickIO('deviceName', 'MyEV3', 'channel', 1, 'backend', 'serial'); 
-            %     % Connecting on mac/linux 
-            %     commHandle = btBrickIO('serPort', '/dev/rfcomm0');
-            %
-            % See also BTBRICKIO.SETPROPERTIES
-            
-            brickIO.setProperties(varargin{:});
-            
-            if brickIO.debug > 0
-                fprintf('(DEBUG) btBrickIO init\n');
-            end
-            
-            % Set the connection handle
-            try
-                if strcmp(brickIO.backend, 'serial')
-                   brickIO.handle = serial(brickIO.serialPort);
-                else
-                   brickIO.handle = Bluetooth(brickIO.deviceName,brickIO.channel);
-                end
-            catch ME
-                if ~isempty(strfind(ME.identifier, 'invalidPORT'))
-                    % Throw a clean InvalidSerialPort to avoid confusion in upper layers
-                    msg = 'Couldn''t connect to BT-device because given serial port is invalid.';
-                    id = [ID(), ':', 'InvalidSerialPort'];
-                    throw(MException(id, msg));
-                else
-                    % Throw combined error because error did not happen due to known reasons...
-                    msg = 'Unknown error occurred while creating serial-port-object for BT connection.';
-                    id = [ID(), ':', 'UnknownError'];
-                    newException = MException(id, msg);
-                    newException = addCause(newException, ME);
-                    throw(newException);
-                end
-            end
-            
-            % Open the connection
-            brickIO.open;
-        end
-        
-        function delete(brickIO)
-            % Delete the btBrickIO object and closes the connection
-            
-            if brickIO.debug > 0
-                fprintf('(DEBUG) (BT delete\n');
-            end
-            
-            % Disconnect
-            try
-                brickIO.close;
-            catch
-                % Connection already closed (probably due to an error) - do nothing
-            end
-        end
-        
-        function open(brickIO)
-            % Opens the bluetooth connection to the brick using fopen.
-            
-            if brickIO.debug > 0
-                fprintf('(DEBUG) (BT open)\n');
-            end
-            
-            % Open the bt handle
-            try
-                fopen(brickIO.handle);
-            catch ME 
-                if strcmp(ME.identifier, 'MATLAB:serial:fopen:opfailed')
-                    % Throw only clean CommError to avoid confusion in upper layers
-                    msg = 'Failed to open connection to Brick via Bluetooth.';
-                    id = [ID(), ':', 'CommError'];
-                    throw(MException(id, msg));
-                else
-                    % Throw combined error because error did not happen due to communication
-                    % failure
-                    msg = 'Unknown error occurred while connecting to the Brick via Bluetooth.';
-                    id = [ID(), ':', 'UnknownError'];
-                    newException = MException(id, msg);
-                    newException = addCause(newException, ME);
-                    throw(newException);
-                end
-            end
-        end
-
-        function close(brickIO)
-            % Closes the bluetooth connection the brick using fclose.
-            
-            if brickIO.debug > 0
-                fprintf('(DEBUG) (BT close) \n');
-            end 
-            
-            try
-                % Close the close handle
-                fclose(brickIO.handle);
-            catch ME
-                % Throw combined error because error did not happen due to communication
-                % failure
-                msg = 'Unknown error occurred while disconnecting from the Brick via Bluetooth.';
-                id = [ID(), ':', 'UnknownError'];
-                newException = MException(id, msg);
-                newException = addCause(newException, ME);
-                throw(newException);
-            end
-        end
-        
-        function rmsg = read(brickIO)
-            % Reads data from the brick through bluetooth via fread and returns the data in uint8 format.
-            
-            if brickIO.debug > 0
-                fprintf('(DEBUG) (BT read) \n');
-            end 
-            
-            try
-                % Get the number of bytes to be read from the bt handle
-                nLength = fread(brickIO.handle,2);
-
-                % Read the remaining bytes
-                rmsg = fread(brickIO.handle,double(typecast(uint8(nLength),'uint16')));
-            catch ME
-                if strcmp(ME.identifier, 'MATLAB:serial:fread:opfailed')
-                    % Throw only clean CommError to avoid confusion in upper layers
-                    msg = 'Failed to read data from Brick via Bluetooth.';
-                    id = [ID(), ':', 'CommError'];
-                    throw(MException(id, msg));
-                else
-                    % Throw combined error because error did not happen due to known reasons...
-                    msg = 'Unknown error occurred while reading data from the Brick via BT.';
-                    id = [ID(), ':', 'UnknownError'];
-                    newException = MException(id, msg);
-                    newException = addCause(newException, ME);
-                    throw(newException);
-                end
-            end
-            
-            % Append the reply size to the return message
-            rmsg = uint8([nLength' rmsg']);
-        end
-        
-        function write(brickIO,wmsg)
-            % Writes data to the brick through bluetooth via fwrite.
-            %
-            % Arguments:
-            %     wmsg (uint8 array): Data to be written to the brick via bluetooth
-            
-            if brickIO.debug > 0
-                fprintf('(DEBUG) btBrickIO write\n');
-            end 
-            
-            try
-                % Write to the bluetooth handle
-                fwrite(brickIO.handle,wmsg);
-            catch ME
-                if strcmp(ME.identifier, 'MATLAB:serial:fwrite:opfailed')
-                    % Throw only clean CommError to avoid confusion in upper layers
-                    msg = 'Failed to send data to Brick via Bluetooth.';
-                    id = [ID(), ':', 'CommError'];
-                    throw(MException(id, msg));
-                else
-                    % Throw combined error because error did not happen due to known reasons...
-                    msg = 'Unknown error occurred while sending data to the Brick via BT.';
-                    id = [ID(), ':', 'UnknownError'];
-                    newException = MException(id, msg);
-                    newException = addCause(newException, ME);
-                    throw(newException);
-                end
-            end
-        end
-        
-        function set.timeOut(brickIO, timeOut)
-            if ~isnumeric(timeOut) || timeOut < 0
-                error(ID(), 'timeOut-period of Bluetooth-handle can only be set to positive numerical values.'); 
-            end
-            
-            brickIO.timeOut = timeOut;
-            
-            if timeOut == 0
-               brickIO.handle.Timeout = 9999999; % MATLAB.serial seems to have no option to disable timeout
-            end
-        end
-        function set.backend(brickIO, backend)
-            if ~strcmp(backend, 'serial')
-                if ~strcmp(backend, 'instrumentControl')
-                    msg = 'btBrickIO''s backend-parameter has to be either ''serial'' or ''instrumentControl''.';
-                    id = [ID(), ':', 'InvalidParameter'];
-                    throw(MException(id, msg));
-                elseif ~license('test', 'instr_control_toolbox')
-                    msg = 'Cannot use Instrument-Control-Toolbox for Bluetooth: Toolbox not installed.';
-                    id = [ID(), ':', 'AssetNotAvailable'];
-                    throw(MException(id, msg));
-                end
-            end
-            
-            brickIO.backend = backend;
-        end
-        function setProperties(brickIO, varargin)
-            % Sets multiple btBrickIO properties at once using MATLAB's inputParser.
-            %
-            % The syntax is as follows: commHandle.setProperties('propertyName1',
-            % propertyValue1, 'propertyName2', propertyValue2, ...). Valid, optional properties
-            % are: debug, serPort, deviceName, channel, timeout.
-            %
-            % See also BTBRICKIO.DEBUG, BTBRICKIO.SERIALPORT, BTBRICKIO.DEVICENAME,
-            % BTBRICKIO.CHANNEL, BTBRICKIO.TIMEOUT
-            
-            p = inputParser();
-            p.KeepUnmatched = 1;
-            
-            p.addOptional('debug', false);
-            p.addOptional('serPort', '/dev/rfcomm0');
-            p.addOptional('deviceName', 'EV3');
-            p.addOptional('channel', 1);
-            p.addOptional('timeOut', 10);
-            if(ispc && license('test', 'instr_control_toolbox'))  % Choose 'backend'-default depending on OS
-                p.addOptional('backend', 'instrumentControl');
-            else
-                p.addOptional('backend', 'serial');
-            end
-            
-            p.parse(varargin{:});
-            
-            brickIO.debug = p.Results.debug;
-            brickIO.serialPort = p.Results.serPort;
-            brickIO.deviceName = p.Results.deviceName;
-            brickIO.channel = p.Results.channel;
-            brickIO.timeOut = p.Results.timeOut;
-            brickIO.backend = p.Results.backend;
-        end
-    end 
-end
+classdef btBrickIO < BrickIO      
+    % Bluetooth interface between MATLAB and the brick
+    %
+    % Notes:
+    %     * Connects to the bluetooth module on the host through a serial
+    %       connection. Hence be sure that a serial connection to the bluetooth
+    %       module can be made. Also be sure that the bluetooth module has been paired
+    %       to the brick before trying to connect.
+    %     * Usage is OS-dependent:
+    %           * Windows: the deviceName- & channel-properties are needed for connection. The implementation is based on the Instrument Control toolbox.
+    %           * Linux (and potentially Mac): serialPort-property is needed for connection. The implementation is based on MATLAB's serial port implementation.
+    %
+    %     * For general information, see also :class:`BrickIO`.
+    %
+    % Attributes:
+    %     debug (bool): If true, each open/close/read/write-call will be shown in the console.
+    %        Defaults to false.
+    %     serialPort (string): Path to the serial-port object. Only needed when using MATLAB's 
+    %        serial class (i.e. on linux/mac). Defaults to '/dev/rfcomm0'.
+    %     deviceName (string):  Name of the BT-device = the brick. Only needed when using the 
+    %        Instrument Control toolbox (i.e. on windows). Defaults to 'EV3'.
+    %     channel (numeric > 0): BT-channel of the connected BT-device. Only needed when using 
+    %        the Instrument Control toolbox (i.e. on windows). Defaults to 1.
+    %     timeOut (numeric >= 0): seconds after which a timeout-error occurs if no packet could be
+    %        read. Defaults to 10.
+    %     backend ('serial'|'instrumentControl'): Backend this implementation is based on. Is
+    %        automatically chosen depending on the OS. Defaults to 'serial' on linux/mac
+    %        systems, and to 'instrumentControl' on windows systems.
+    %
+    % 
+    % Examples:
+    %     % Connecting on windows |br|
+    %     commHandle = btBrickIO('deviceName', 'MyEV3', 'channel', 1); % |br| 
+    %     % Connecting on windows using MATLABs default serial port implementation for testing |br|
+    %     commHandle = btBrickIO('deviceName', 'MyEV3', 'channel', 1, 'backend', 'serial'); % |br|
+    %     % Connecting on mac/linux |br|
+    %     commHandle = btBrickIO('serPort', '/dev/rfcomm0'); % |br| 
+    %
+    
+    properties
+        % debug (bool): If true, each open/close/read/write-call will be noted in the console.
+        %     Defaults to false.
+        debug;
+        % serialPort (string): Path to the serial-port object. Defaults to '/dev/rfcomm0'.
+        %     Only needed when using MATLAB's serial class (i.e. on linux/mac). 
+        serialPort;
+        % deviceName (string):  Name of the BT-device = the brick. Defaults to 'EV3'.
+        %     Only needed when using the Instrument Control toolbox (i.e. on windows). 
+        deviceName;
+        % channel (numeric > 0): BT-channel of the connected BT-device. Defaults to 1.
+        %     Only needed when using the Instrument Control toolbox (i.e. on windows). 
+        channel;
+        % timeOut (numeric > 0): Seconds after which a timeout-error occurs if no packet could be read. 
+        %     Defaults to 10.
+        timeOut;
+        % backend ('serial'|'instrumentControl'): Backend this implementation is based on. 
+        %     Is automatically chosen depending on the OS. Defaults to 'serial' on linux/mac
+        %     systems, and to 'instrumentControl' on windows systems.
+        backend;
+    end
+    
+    properties (Access = protected)
+        % handle: Connection handle to the device
+        handle;
+    end 
+    
+    methods
+        function brickIO = btBrickIO(varargin)
+            % Create a btBrickIO object
+            %
+            % Arguments:
+            %     varargin: Any number of property names as strings, each followed by the
+            %         desired value. 
+            % 
+            % Examples: 
+            %     % Connecting on windows
+            %     commHandle = btBrickIO('deviceName', 'MyEV3', 'channel', 1); 
+            %     % Connecting on windows using MATLABs default serial port implementation for testing
+            %     commHandle = btBrickIO('deviceName', 'MyEV3', 'channel', 1, 'backend', 'serial'); 
+            %     % Connecting on mac/linux 
+            %     commHandle = btBrickIO('serPort', '/dev/rfcomm0');
+            %
+            % See also BTBRICKIO.SETPROPERTIES
+            
+            brickIO.setProperties(varargin{:});
+            
+            if brickIO.debug > 0
+                fprintf('(DEBUG) btBrickIO init\n');
+            end
+            
+            % Set the connection handle
+            try
+                if strcmp(brickIO.backend, 'serial')
+                   brickIO.handle = serial(brickIO.serialPort);
+                else
+                   brickIO.handle = Bluetooth(brickIO.deviceName,brickIO.channel);
+                end
+            catch ME
+                if ~isempty(strfind(ME.identifier, 'invalidPORT'))
+                    % Throw a clean InvalidSerialPort to avoid confusion in upper layers
+                    msg = 'Couldn''t connect to BT-device because given serial port is invalid.';
+                    id = [ID(), ':', 'InvalidSerialPort'];
+                    throw(MException(id, msg));
+                else
+                    % Throw combined error because error did not happen due to known reasons...
+                    msg = 'Unknown error occurred while creating serial-port-object for BT connection.';
+                    id = [ID(), ':', 'UnknownError'];
+                    newException = MException(id, msg);
+                    newException = addCause(newException, ME);
+                    throw(newException);
+                end
+            end
+            
+            % Open the connection
+            brickIO.open;
+        end
+        
+        function delete(brickIO)
+            % Delete the btBrickIO object and closes the connection
+            
+            if brickIO.debug > 0
+                fprintf('(DEBUG) (BT delete\n');
+            end
+            
+            % Disconnect
+            try
+                brickIO.close;
+            catch
+                % Connection already closed (probably due to an error) - do nothing
+            end
+        end
+        
+        function open(brickIO)
+            % Opens the bluetooth connection to the brick using fopen.
+            
+            if brickIO.debug > 0
+                fprintf('(DEBUG) (BT open)\n');
+            end
+            
+            % Open the bt handle
+            try
+                fopen(brickIO.handle);
+            catch ME 
+                if strcmp(ME.identifier, 'MATLAB:serial:fopen:opfailed')
+                    % Throw only clean CommError to avoid confusion in upper layers
+                    msg = 'Failed to open connection to Brick via Bluetooth.';
+                    id = [ID(), ':', 'CommError'];
+                    throw(MException(id, msg));
+                else
+                    % Throw combined error because error did not happen due to communication
+                    % failure
+                    msg = 'Unknown error occurred while connecting to the Brick via Bluetooth.';
+                    id = [ID(), ':', 'UnknownError'];
+                    newException = MException(id, msg);
+                    newException = addCause(newException, ME);
+                    throw(newException);
+                end
+            end
+        end
+
+        function close(brickIO)
+            % Closes the bluetooth connection the brick using fclose.
+            
+            if brickIO.debug > 0
+                fprintf('(DEBUG) (BT close) \n');
+            end 
+            
+            try
+                % Close the close handle
+                fclose(brickIO.handle);
+            catch ME
+                % Throw combined error because error did not happen due to communication
+                % failure
+                msg = 'Unknown error occurred while disconnecting from the Brick via Bluetooth.';
+                id = [ID(), ':', 'UnknownError'];
+                newException = MException(id, msg);
+                newException = addCause(newException, ME);
+                throw(newException);
+            end
+        end
+        
+        function rmsg = read(brickIO)
+            % Reads data from the brick through bluetooth via fread and returns the data in uint8 format.
+            
+            if brickIO.debug > 0
+                fprintf('(DEBUG) (BT read) \n');
+            end 
+            
+            try
+                % Get the number of bytes to be read from the bt handle
+                nLength = fread(brickIO.handle,2);
+
+                % Read the remaining bytes
+                rmsg = fread(brickIO.handle,double(typecast(uint8(nLength),'uint16')));
+            catch ME
+                if strcmp(ME.identifier, 'MATLAB:serial:fread:opfailed')
+                    % Throw only clean CommError to avoid confusion in upper layers
+                    msg = 'Failed to read data from Brick via Bluetooth.';
+                    id = [ID(), ':', 'CommError'];
+                    throw(MException(id, msg));
+                else
+                    % Throw combined error because error did not happen due to known reasons...
+                    msg = 'Unknown error occurred while reading data from the Brick via BT.';
+                    id = [ID(), ':', 'UnknownError'];
+                    newException = MException(id, msg);
+                    newException = addCause(newException, ME);
+                    throw(newException);
+                end
+            end
+            
+            % Append the reply size to the return message
+            rmsg = uint8([nLength' rmsg']);
+        end
+        
+        function write(brickIO,wmsg)
+            % Writes data to the brick through bluetooth via fwrite.
+            %
+            % Arguments:
+            %     wmsg (uint8 array): Data to be written to the brick via bluetooth
+            
+            if brickIO.debug > 0
+                fprintf('(DEBUG) btBrickIO write\n');
+            end 
+            
+            try
+                % Write to the bluetooth handle
+                fwrite(brickIO.handle,wmsg);
+            catch ME
+                if strcmp(ME.identifier, 'MATLAB:serial:fwrite:opfailed')
+                    % Throw only clean CommError to avoid confusion in upper layers
+                    msg = 'Failed to send data to Brick via Bluetooth.';
+                    id = [ID(), ':', 'CommError'];
+                    throw(MException(id, msg));
+                else
+                    % Throw combined error because error did not happen due to known reasons...
+                    msg = 'Unknown error occurred while sending data to the Brick via BT.';
+                    id = [ID(), ':', 'UnknownError'];
+                    newException = MException(id, msg);
+                    newException = addCause(newException, ME);
+                    throw(newException);
+                end
+            end
+        end
+        
+        function set.timeOut(brickIO, timeOut)
+            if ~isnumeric(timeOut) || timeOut < 0
+                error(ID(), 'timeOut-period of Bluetooth-handle can only be set to positive numerical values.'); 
+            end
+            
+            brickIO.timeOut = timeOut;
+            
+            if timeOut == 0
+               brickIO.handle.Timeout = 9999999; % MATLAB.serial seems to have no option to disable timeout
+            end
+        end
+        function set.backend(brickIO, backend)
+            if ~strcmp(backend, 'serial')
+                if ~strcmp(backend, 'instrumentControl')
+                    msg = 'btBrickIO''s backend-parameter has to be either ''serial'' or ''instrumentControl''.';
+                    id = [ID(), ':', 'InvalidParameter'];
+                    throw(MException(id, msg));
+                elseif ~license('test', 'instr_control_toolbox')
+                    msg = 'Cannot use Instrument-Control-Toolbox for Bluetooth: Toolbox not installed.';
+                    id = [ID(), ':', 'AssetNotAvailable'];
+                    throw(MException(id, msg));
+                end
+            end
+            
+            brickIO.backend = backend;
+        end
+        function setProperties(brickIO, varargin)
+            % Sets multiple btBrickIO properties at once using MATLAB's inputParser.
+            %
+            % The syntax is as follows: commHandle.setProperties('propertyName1',
+            % propertyValue1, 'propertyName2', propertyValue2, ...). Valid, optional properties
+            % are: debug, serPort, deviceName, channel, timeout.
+            %
+            % See also BTBRICKIO.DEBUG, BTBRICKIO.SERIALPORT, BTBRICKIO.DEVICENAME,
+            % BTBRICKIO.CHANNEL, BTBRICKIO.TIMEOUT
+            
+            p = inputParser();
+            p.KeepUnmatched = 1;
+            
+            p.addOptional('debug', false);
+            p.addOptional('serPort', '/dev/rfcomm0');
+            p.addOptional('deviceName', 'EV3');
+            p.addOptional('channel', 1);
+            p.addOptional('timeOut', 10);
+            if(ispc && license('test', 'instr_control_toolbox'))  % Choose 'backend'-default depending on OS
+                p.addOptional('backend', 'instrumentControl');
+            else
+                p.addOptional('backend', 'serial');
+            end
+            
+            p.parse(varargin{:});
+            
+            brickIO.debug = p.Results.debug;
+            brickIO.serialPort = p.Results.serPort;
+            brickIO.deviceName = p.Results.deviceName;
+            brickIO.channel = p.Results.channel;
+            brickIO.timeOut = p.Results.timeOut;
+            brickIO.backend = p.Results.backend;
+        end
+    end 
+end
diff --git a/source/hidapi.m b/source/hidapi.m
old mode 100755
new mode 100644
index a4a35a5bfb0d1b7486943ab7776f1bbc62176b38..a9f17b2af7d36a8e4c0797a9bb69034280dc9e50
--- a/source/hidapi.m
+++ b/source/hidapi.m
@@ -1,497 +1,497 @@
-classdef hidapi < handle
-    % Interface to the hidapi library
-    % 
-    % Notes:
-    %     * Developed from the hidapi available at http://www.signal11.us/oss/hidapi/.
-    %     * Windows: hidapi.dll needed.
-    %     * Mac: hidapi.dylib needed. In addition, Xcode has to be installed.
-    %     * Linux: hidapi has to be compiled on host-system. 
-    % 
-    % Attributes:
-    %     handle ():
-    %     vendorID (numeric): Vendor-ID of the USB device.
-    %     productID (numeric): Product-ID of the USB device. 
-    %     nReadBuffer (numeric): Read-buffer size in bytes.
-    %     nWriteBuffer (numeric): Write-buffer size in bytes. Needs to be 1 Byte bigger than
-    %        actual packet.
-    %     slib (string): Name of shared library file (without file extension). Defaults to
-    %        'hidapi'.
-    %     sheader (string): Name of shared library header. Defaults to 'hidapi.h'.
-    %
-    % Example:
-    %     hidHandle = hidapi(1684,0005,1024,1025); %|br|
-    %
-    
-    properties
-        % handle: Connection handle to the device.
-        handle
-        % vendorID (numeric): Vendor-ID of the USB device.
-        vendorID;
-        % productID (numeric): Product-ID of the USB device.
-        productID;
-        % nReadBuffer (numeric): Read-buffer size in bytes. 
-        nReadBuffer;
-        % nWriteBuffer (numeric): Write-buffer size in bytes.
-        %    Needs to be 1 Byte bigger than actual packet.
-        nWriteBuffer;
-        % slib (string): Name of shared library file (without file extension). Defaults to 'hidapi'.
-        slib = 'hidapi';
-        % sheader (string): Name of shared library header. Defaults to 'hidapi.h'.
-        sheader = 'hidapi.h';
-    end
-    
-    methods
-        %% Constructor
-        
-        function hid = hidapi(vendorID,productID,nReadBuffer,nWriteBuffer)
-            % Create a hidapi library interface object from the corresponding library 
-            %
-            % Arguments:
-            %     vendorID (numeric): Vendor-ID of the USB device in decimal.
-            %     productID (numeric): Product-ID of the USB device in decimal. 
-            %     nReadBuffer (numeric): Read-buffer size in bytes.
-            %     nWriteBuffer (numeric): Write-buffer size in bytes. Needs to be 1 Byte bigger than
-            %        actual packet.
-            %
-            % Raises:
-            %     LoadingLibraryError: Could not load .dll/.dylib/.so-file of hidapi.
-            %     InvalidFileNameOrFileMissing: Either file names given were wrong or the files 
-            %        are missing (thunk files, proto files, ...).
-            %
-            
-            hid.vendorID = vendorID;
-            hid.productID = productID;
-            hid.nReadBuffer = nReadBuffer;
-            hid.nWriteBuffer = nWriteBuffer;
-            
-            % Disable warnings
-            warning('off','MATLAB:loadlibrary:TypeNotFoundForStructure');
-            warning('off', 'MATLAB:loadlibrary:ClassIsLoaded');
-            
-            try
-                % Check the operating system type and load slib
-                if (ispc == 1)
-                    % Check the bit version
-                    if (strcmp(mexext,'mexw32'))
-                        hid.slib = 'hidapi32';
-                        % Load the library via the proto file
-                        loadlibrary(hid.slib,@hidapi32_proto,'alias','hidapiusb')
-                    elseif (strcmp(mexext,'mexw64'))
-                        hid.slib = 'hidapi64';
-                        % Load the library via the proto file
-                        loadlibrary(hid.slib,@hidapi64_proto,'alias','hidapiusb')
-                    end
-                elseif (ismac == 1)
-                    hid.slib = 'hidapi64';
-                    % Load the library via the proto file
-                    loadlibrary(hid.slib,@hidapi64mac_proto,'alias','hidapiusb');
-                elseif (isunix == 1)
-                    hid.slib = 'libhidapi-libusb';
-                    % Load the shared library
-                    loadlibrary(hid.slib,@hidapi_libusb_proto,'alias','hidapiusb');
-                end
-            catch ME
-                % Create own exception for clarification
-                id = [hid.slib, ':', 'LoadingLibraryError'];
-                msg = strcat({'Could not load library '}, {hid.slib}, {'.'});
-                exception = MException(id, msg);
-
-                % Try to narrow down loading failure
-                if isempty(findstr(ME.identifier, 'LoadFailed')) ...
-                        && isempty(findstr(ME.identifier, 'ErrorLoadingLibrary')) ...
-                        && isempty(findstr(ME.identifier, 'ErrorInHeader'))
-                    id = [hid.slib, ':', 'InvalidFileNameOrFileMissing'];
-                    msg = 'Invalid file names were given or files are not available.';
-                    cause = MException(id, msg);
-                    exception = addCause(exception, cause);
-                end
-
-                throw(exception);
-            end
-            
-            % Remove the library extension
-            hid.slib = 'hidapiusb';
-
-%             if hid.debug > 0
-%                 libfunctionsview('hidapiusb');
-%             end
-        end
-        
-        function delete(hid)
-            % Close an open hid device connection and delete the object. 
-            %
-            % Notes:
-            %     * You cannot unloadlibrary in this function as the object is still present 
-            %       in the MATLAB work space. Todo: Any alternative?
-        end
-        
-        %% HIDAPI-Functions
-        
-        function open(hid)
-            % Open a connection with a hid device
-            %
-            % Throws:
-            %     CommError: Error during communication with device
-            %
-            % Notes: 
-            %     * Gets called automatically when creating an hidapi-object.
-            %     * The pointer return value from this library call is always null so it is not 
-            %       possible to know if the open was successful.
-            %     * The final parameter to the open hidapi library call has different types 
-            %       depending on OS. On windows it is uint16, on linux/mac int32.
-            
-            % Create a null pointer for the hid_open function (depends on OS)
-            if (ispc == 1)
-                pNull = libpointer('uint16Ptr');
-            elseif ((ismac == 1) || (isunix == 1))
-                pNull = libpointer('int32Ptr');
-            end
-            
-            % Open the hid interface
-            [newHandle,value] = calllib(hid.slib,'hid_open',uint16(hid.vendorID), ...
-                uint16(hid.productID),pNull);
-            
-            % (MMI) Assert error case (hid_open returns null-pointer in error case)
-            assert(isLibPointerValid(newHandle)==1, ...
-                [hid.slib, ':', 'CommError'], ...
-                'Failed to connect to USB device.');
-            
-            hid.handle = newHandle;
-        end
-        
-        function close(hid)
-            % Close the connection to a hid device. 
-            %
-            % Throws:
-            %     InvalidHandle: Handle to USB-device not valid
-            %
-            % Notes:
-            %     * Gets called automatically when deleting the hidapi instance.
-            
-            % (MMI) Check if pointer is (unexpectedly) already invalidated
-            assert(isLibPointerValid(hid.handle)==1, ...
-                [hid.slib, ':', 'InvalidHandle'], ...
-                'Failed to close USB-connection because pointer to USB-device is already invalidated.');
-            
-            % Close the connection
-            calllib(hid.slib,'hid_close',hid.handle);
-            
-            % Invalidate the pointer
-            hid.handle = [];
-        end
-        
-        % Implemented @ MMI
-        function rmsg = read_timeout(hid, timeOut)
-            % Read from a hid device with a timeout and return the read bytes. 
-            %
-            % Arguments:
-            %     timeOut (numeric >= 0): Milliseconds after which a timeout-error occurs if no 
-            %         packet could be read.
-            %
-            % Throws:
-            %     CommError: Error during communication with device
-            %     InvalidHandle: Handle to USB-device not valid
-            %
-            
-            % Read buffer of nReadBuffer length
-            buffer = zeros(1,hid.nReadBuffer);
-            % Create a uint8 pointer
-            pbuffer = libpointer('uint8Ptr', uint8(buffer));
-            
-            % Check if pointer is (unexpectedly) already invalidated
-            assert(isLibPointerValid(hid.handle)==1, ...
-                [hid.slib, ':', 'InvalidHandle'], ...
-                'Failed to read USB-data because pointer to USB-device is invalidated.');
-            
-            % Read data from HID device
-            [res,h] = calllib(hid.slib,'hid_read_timeout',hid.handle,pbuffer,uint64(length(buffer)),timeOut);
-            
-            % Check the response (No assert as there are multiple cases)
-            if res < 1
-                % Error occurred
-                id = [hid.slib, ':', 'CommError'];
-                % Narrow error down
-                if res == -1
-                    msg = 'Connection error (probably lost connection to device)';
-                elseif res == 0
-                    msg = ['Could not read data from device (device is still connected, ',...
-                           'but does not react)'];
-                else
-                    msg = 'Unexpected connection error';
-                end
-                causeException = MException(id, msg);
-                ME = MException(id, 'Failed to read data via USB.');
-                addCause(ME, causeException);
-                throw(ME);
-            end
-            
-            % Return the string value
-            rmsg = pbuffer.Value;
-        end
-        
-        function rmsg = read(hid)
-            % Read from a hid device and returns the read bytes.
-            %
-            % Throws:
-            %     CommError: Error during communication with device
-            %     InvalidHandle: Handle to USB-device not valid
-            % 
-            % Notes: 
-            %     * Will print an error if no data was read.
-            %
-            
-            % Read buffer of nReadBuffer length
-            buffer = zeros(1,hid.nReadBuffer);
-            % Create a uint8 pointer
-            pbuffer = libpointer('uint8Ptr', uint8(buffer));
-            
-            % (MMI) Check if pointer is (unexpectedly) already invalidated
-            assert(isLibPointerValid(hid.handle)==1, ...
-                [hid.slib, ':', 'InvalidHandle'], ...
-                'Failed to read USB-data because pointer to USB-device is invalidated.');
-            
-            % Read data from HID device
-            [res,h] = calllib(hid.slib,'hid_read',hid.handle,pbuffer,uint64(length(buffer)));
-            
-            % (MMI) Check the response (No assert as there are multiple cases)
-            if res < 1
-                % Error occurred
-                id = [hid.slib, ':', 'CommError'];
-                % Narrow error down
-                if res == -1
-                    msg = 'Connection error (probably lost connection to device)';
-                elseif res == 0
-                    msg = ['Could not read data from device (device is still connected, ',...
-                           'but does not react)'];
-                else
-                    msg = 'Unexpected connection error';
-                end
-                causeException = MException(id, msg);
-                ME = MException(id, 'Failed to read data via USB.');
-                addCause(ME, causeException);
-                throw(ME);
-            end
-            
-            % Return the string value
-            rmsg = pbuffer.Value;
-        end
-        
-        function write(hid,wmsg,reportID)
-            % Write to a hid device.
-            %
-            % Throws:
-            %     CommError: Error during communication with device
-            %     InvalidHandle: Handle to USB-device not valid
-            %
-            % Notes: 
-            %     * Will print an error if there is a mismatch between the buffer size and the 
-            %       reported number of bytes written.
-            %
-            
-            % Append a 0 at the front for HID report ID
-            wmsg = [reportID wmsg];
-            
-            % Pad with zeros for nWriteBuffer length
-            % (MMI) Note:: The following line does not seem to be necessary;
-            % wmsg does not need to be the max packet size. Uncommenting this doesn't affect
-            % anything, and I would prefer sending short messages over long ones.
-            % Further testing may be required, so for now I don't change a thing.
-            % (MMI) Update:: Okay, so under Windows, this line IS necessary, as well as the
-            % fixed write-buffer size of 1025 bytes for EV3 (== wMaxPacketSize+1; smaller packets fail; 
-            % bigger packets do get handled by the brick, but the second assertion below will fail).
-            wmsg(end+(hid.nWriteBuffer-length(wmsg))) = 0;
-            
-            % Create a uint8 pointer
-            pbuffer = libpointer('uint8Ptr', uint8(wmsg));
-            
-            % (MMI) Check if pointer is (unexpectedly) already invalidated
-            assert(isLibPointerValid(hid.handle)==1, ...
-                [hid.slib, ':', 'InvalidHandle'], ...
-                'Failed to write to USB because pointer to USB-device is invalidated.');
-            
-            % Write the message
-            [res,h] = calllib(hid.slib,'hid_write',hid.handle,pbuffer,uint64(length(wmsg)));
-            
-            % (MMI) Check the response
-            assert(res == length(wmsg), ...
-                [hid.slib, ':', 'CommError'], ...
-                'Failed to write data via USB.');
-        end
-        
-        function str = getHIDInfoString(hid,info)
-            % Get the corresponding hid info from the hid device.
-            %
-            % Throws:
-            %     CommError: Error during communication with device
-            %     InvalidHandle: Handle to USB-device not valid
-            %
-            % Notes:
-            %     * Info is the hid information string. 
-            %
-            % See also HIDAPI.GETMANUFACTURERSSTRING, HIDAPI.GETPRODUCTSTRING,
-            % HIDAPI.GETSERIALNUMBERSTRING.
-            %
-            
-            % Read buffer nReadBuffer length
-            buffer = zeros(1,hid.nReadBuffer);
-            % Create a libpointer (depends on OS)
-            if (ispc == 1)
-                pbuffer = libpointer('uint16Ptr', uint16(buffer));
-            elseif ((ismac == 1) || (isunix == 1))
-                pbuffer = libpointer('int32Ptr', uint32(buffer));
-            end
-            
-            % (MMI) Check if pointer is (unexpectedly) already invalidated
-            assert(isLibPointerValid(hid.handle)==1, ...
-                [hid.slib, ':', 'InvalidHandle'], ...
-                'Failed to read USB-data because pointer to USB-device is invalidated.');
-            
-            % Get the HID info string
-            [res,h] = calllib(hid.slib,info,hid.handle,pbuffer,uint32(length(buffer)));
-            
-            % (MMI) Check the response
-            assert(res~=-1, ...
-                [hid.slib, ':', 'CommError'], ...
-                'Failed to read HID info string.');
-            
-            % Return the string value
-            str = sprintf('%s',char(pbuffer.Value));
-        end
-        
-        function setNonBlocking(hid,nonblock)
-            % Set the non blocking flag on the hid device connection.
-            %
-            % Arguments:
-            %     nonblock (numeric in {0,1}): 0 disables nonblocking, 1 enables nonblocking
-            %
-            % Throws:
-            %     CommError: Error during communication with device
-            %     InvalidHandle: Handle to USB-device not valid
-            %
-            
-            % (MMI) Check if pointer is (unexpectedly) already invalidated
-            assert(isLibPointerValid(hid.handle)==1, ...
-                [hid.slib, ':', 'InvalidHandle'], ...
-                'Failed to set USB-read-mode to non-blocking because pointer to USB-device is invalidated.');
-            
-            % Set non blocking
-            [res,h] = calllib(hid.slib,'hid_set_nonblocking',hid.handle,uint32(nonblock));
-            
-            % (MMI) Check the response
-            assert(res~=-1, ...
-                [hid.slib, ':', 'CommError'], ...
-                'Failed to set USB-read-mode to non-blocking.');
-        end
-        
-        function init(hid)
-            % Inits the hidapi library. 
-            %
-            % Throws:
-            %     CommError: Error during communication with device
-            %
-            % Notes:
-            %     * This is called automatically in the library itself with the open function. You 
-            %       should not have to call this function directly.
-            %
-            
-            warning([hid.slib, ':', 'RedundantCall'], ...
-                'The init-function gets called automatically when connecting!');
-            
-            % Init device
-            res = calllib(hid.slib,'hid_init');
-            
-            % (MMI) Check the response
-            assert(res~=-1, ...
-                [hid.slib, ':', 'CommError'], ...
-                'Failed to init USB-device.');
-        end
-        
-        function exit(hid)
-            %hidapi.exit Exit hidapi
-            %
-            % hid.exit() exits the hidapi library.
-            %
-            % Throws:
-            %     CommError: Error during communication with device
-            %
-            % Notes::
-            % - You should not have to call this function directly.
-            
-            warning([hid.slib, ':', 'RedundantCall'], ...
-                'The exit-function gets called automatically when disconnecting!');
-            
-            % Exit device
-            res = calllib(hid.slib,'hid_exit');
-            
-            % (MMI) Check the response
-            assert(res~=-1, ...
-                [hid.slib, ':', 'CommError'], ...
-                'Failed to exit USB-device.');
-        end
-        
-        function str = error(hid)
-            % Return the hid device error string if a function produced an error.
-            %
-            % Throws:
-            %     InvalidHandle: Handle to USB-device not valid
-            %
-            % Notes:
-            %     * This function must be called explicitly if you think an error was generated 
-            %       from the hid device.
-            % 
-            
-            % (MMI) Check if pointer is (unexpectedly) already invalidated
-            assert(isLibPointerValid(hid.handle)==1, ...
-                [hid.slib, ':', 'InvalidHandle'], ...
-                'Failed to read USB-error-data because pointer to USB-device is invalidated.');
-            
-            [~,str] = calllib(hid.slib,'hid_error',hid.handle);
-        end
-        
-        function str = enumerate(hid,vendorID,productID)
-            % Enumerates the info about the hid device with the given vendorID and productID 
-            % and returns a string with the returned hid information.
-            %
-            % Arguments:
-            %     vendorID (numeric): Vendor-ID of the USB device in decimal.
-            %     productID (numeric): Product-ID of the USB device in decimal. 
-            %
-            % Notes:
-            %     * Using a vendorID and productID of (0,0) will enumerate all connected hid 
-            %       devices.
-            %     * MATLAB does not have the hid_device_infoPtr struct so some of the returned 
-            %       information will need to be resized and cast into uint8 or chars.
-            %
-            
-            % Enumerate the hid devices
-            str = calllib(u.slib,'hid_enumerate',uint16(vendorID),uint16(productID));
-        end
-        
-        %% Wrapper 
-        
-        function str = getManufacturersString(hid)
-            % Get manufacturers string from hid object using getHIDInfoString.
-            str = getHIDInfoString(hid,'hid_get_manufacturer_string');
-        end
-        function str = getProductString(hid)
-            % Get product string from hid object using getProductString.
-            str = getHIDInfoString(hid,'hid_get_product_string');
-        end
-        function str = getSerialNumberString(hid)
-            % Get serial number from hid object using getSerialNumberString.
-            str = getHIDInfoString(hid,'hid_get_serial_number_string');
-        end
-    end
-end
-
-% Implemented @ MMI
-function valid = isLibPointerValid(handle)
-    % Check whether hid.handle is valid libpointer
-
-    valid = 0;
-    if ~isempty(handle)
-        if isa(handle, 'handle') && ~isNull(handle)
-            valid = 1;
-        end
-    end
-end
+classdef hidapi < handle      
+    % Interface to the hidapi library
+    % 
+    % Notes:
+    %     * Developed from the hidapi available at http://www.signal11.us/oss/hidapi/.
+    %     * Windows: hidapi.dll needed.
+    %     * Mac: hidapi.dylib needed. In addition, Xcode has to be installed.
+    %     * Linux: hidapi has to be compiled on host-system. 
+    % 
+    % Attributes:
+    %     handle ():
+    %     vendorID (numeric): Vendor-ID of the USB device.
+    %     productID (numeric): Product-ID of the USB device. 
+    %     nReadBuffer (numeric): Read-buffer size in bytes.
+    %     nWriteBuffer (numeric): Write-buffer size in bytes. Needs to be 1 Byte bigger than
+    %        actual packet.
+    %     slib (string): Name of shared library file (without file extension). Defaults to
+    %        'hidapi'.
+    %     sheader (string): Name of shared library header. Defaults to 'hidapi.h'.
+    %
+    % Example:
+    %     hidHandle = hidapi(1684,0005,1024,1025); %|br|
+    %
+    
+    properties
+        % handle: Connection handle to the device.
+        handle
+        % vendorID (numeric): Vendor-ID of the USB device.
+        vendorID;
+        % productID (numeric): Product-ID of the USB device.
+        productID;
+        % nReadBuffer (numeric): Read-buffer size in bytes. 
+        nReadBuffer;
+        % nWriteBuffer (numeric): Write-buffer size in bytes.
+        %    Needs to be 1 Byte bigger than actual packet.
+        nWriteBuffer;
+        % slib (string): Name of shared library file (without file extension). Defaults to 'hidapi'.
+        slib = 'hidapi';
+        % sheader (string): Name of shared library header. Defaults to 'hidapi.h'.
+        sheader = 'hidapi.h';
+    end
+    
+    methods
+        %% Constructor
+        
+        function hid = hidapi(vendorID,productID,nReadBuffer,nWriteBuffer)
+            % Create a hidapi library interface object from the corresponding library 
+            %
+            % Arguments:
+            %     vendorID (numeric): Vendor-ID of the USB device in decimal.
+            %     productID (numeric): Product-ID of the USB device in decimal. 
+            %     nReadBuffer (numeric): Read-buffer size in bytes.
+            %     nWriteBuffer (numeric): Write-buffer size in bytes. Needs to be 1 Byte bigger than
+            %        actual packet.
+            %
+            % Raises:
+            %     LoadingLibraryError: Could not load .dll/.dylib/.so-file of hidapi.
+            %     InvalidFileNameOrFileMissing: Either file names given were wrong or the files 
+            %        are missing (thunk files, proto files, ...).
+            %
+            
+            hid.vendorID = vendorID;
+            hid.productID = productID;
+            hid.nReadBuffer = nReadBuffer;
+            hid.nWriteBuffer = nWriteBuffer;
+            
+            % Disable warnings
+            warning('off','MATLAB:loadlibrary:TypeNotFoundForStructure');
+            warning('off', 'MATLAB:loadlibrary:ClassIsLoaded');
+            
+            try
+                % Check the operating system type and load slib
+                if (ispc == 1)
+                    % Check the bit version
+                    if (strcmp(mexext,'mexw32'))
+                        hid.slib = 'hidapi32';
+                        % Load the library via the proto file
+                        loadlibrary(hid.slib,@hidapi32_proto,'alias','hidapiusb')
+                    elseif (strcmp(mexext,'mexw64'))
+                        hid.slib = 'hidapi64';
+                        % Load the library via the proto file
+                        loadlibrary(hid.slib,@hidapi64_proto,'alias','hidapiusb')
+                    end
+                elseif (ismac == 1)
+                    hid.slib = 'hidapi64';
+                    % Load the library via the proto file
+                    loadlibrary(hid.slib,@hidapi64mac_proto,'alias','hidapiusb');
+                elseif (isunix == 1)
+                    hid.slib = 'libhidapi-libusb';
+                    % Load the shared library
+                    loadlibrary(hid.slib,@hidapi_libusb_proto,'alias','hidapiusb');
+                end
+            catch ME
+                % Create own exception for clarification
+                id = [hid.slib, ':', 'LoadingLibraryError'];
+                msg = strcat({'Could not load library '}, {hid.slib}, {'.'});
+                exception = MException(id, msg);
+
+                % Try to narrow down loading failure
+                if isempty(findstr(ME.identifier, 'LoadFailed')) ...
+                        && isempty(findstr(ME.identifier, 'ErrorLoadingLibrary')) ...
+                        && isempty(findstr(ME.identifier, 'ErrorInHeader'))
+                    id = [hid.slib, ':', 'InvalidFileNameOrFileMissing'];
+                    msg = 'Invalid file names were given or files are not available.';
+                    cause = MException(id, msg);
+                    exception = addCause(exception, cause);
+                end
+
+                throw(exception);
+            end
+            
+            % Remove the library extension
+            hid.slib = 'hidapiusb';
+
+%             if hid.debug > 0
+%                 libfunctionsview('hidapiusb');
+%             end
+        end
+        
+        function delete(hid)
+            % Close an open hid device connection and delete the object. 
+            %
+            % Notes:
+            %     * You cannot unloadlibrary in this function as the object is still present 
+            %       in the MATLAB work space. Todo: Any alternative?
+        end
+        
+        %% HIDAPI-Functions
+        
+        function open(hid)
+            % Open a connection with a hid device
+            %
+            % Throws:
+            %     CommError: Error during communication with device
+            %
+            % Notes: 
+            %     * Gets called automatically when creating an hidapi-object.
+            %     * The pointer return value from this library call is always null so it is not 
+            %       possible to know if the open was successful.
+            %     * The final parameter to the open hidapi library call has different types 
+            %       depending on OS. On windows it is uint16, on linux/mac int32.
+            
+            % Create a null pointer for the hid_open function (depends on OS)
+            if (ispc == 1)
+                pNull = libpointer('uint16Ptr');
+            elseif ((ismac == 1) || (isunix == 1))
+                pNull = libpointer('int32Ptr');
+            end
+            
+            % Open the hid interface
+            [newHandle,value] = calllib(hid.slib,'hid_open',uint16(hid.vendorID), ...
+                uint16(hid.productID),pNull);
+            
+            % (MMI) Assert error case (hid_open returns null-pointer in error case)
+            assert(isLibPointerValid(newHandle)==1, ...
+                [hid.slib, ':', 'CommError'], ...
+                'Failed to connect to USB device.');
+            
+            hid.handle = newHandle;
+        end
+        
+        function close(hid)
+            % Close the connection to a hid device. 
+            %
+            % Throws:
+            %     InvalidHandle: Handle to USB-device not valid
+            %
+            % Notes:
+            %     * Gets called automatically when deleting the hidapi instance.
+            
+            % (MMI) Check if pointer is (unexpectedly) already invalidated
+            assert(isLibPointerValid(hid.handle)==1, ...
+                [hid.slib, ':', 'InvalidHandle'], ...
+                'Failed to close USB-connection because pointer to USB-device is already invalidated.');
+            
+            % Close the connection
+            calllib(hid.slib,'hid_close',hid.handle);
+            
+            % Invalidate the pointer
+            hid.handle = [];
+        end
+        
+        % Implemented @ MMI
+        function rmsg = read_timeout(hid, timeOut)
+            % Read from a hid device with a timeout and return the read bytes. 
+            %
+            % Arguments:
+            %     timeOut (numeric >= 0): Milliseconds after which a timeout-error occurs if no 
+            %         packet could be read.
+            %
+            % Throws:
+            %     CommError: Error during communication with device
+            %     InvalidHandle: Handle to USB-device not valid
+            %
+            
+            % Read buffer of nReadBuffer length
+            buffer = zeros(1,hid.nReadBuffer);
+            % Create a uint8 pointer
+            pbuffer = libpointer('uint8Ptr', uint8(buffer));
+            
+            % Check if pointer is (unexpectedly) already invalidated
+            assert(isLibPointerValid(hid.handle)==1, ...
+                [hid.slib, ':', 'InvalidHandle'], ...
+                'Failed to read USB-data because pointer to USB-device is invalidated.');
+            
+            % Read data from HID device
+            [res,h] = calllib(hid.slib,'hid_read_timeout',hid.handle,pbuffer,uint64(length(buffer)),timeOut);
+            
+            % Check the response (No assert as there are multiple cases)
+            if res < 1
+                % Error occurred
+                id = [hid.slib, ':', 'CommError'];
+                % Narrow error down
+                if res == -1
+                    msg = 'Connection error (probably lost connection to device)';
+                elseif res == 0
+                    msg = ['Could not read data from device (device is still connected, ',...
+                           'but does not react)'];
+                else
+                    msg = 'Unexpected connection error';
+                end
+                causeException = MException(id, msg);
+                ME = MException(id, 'Failed to read data via USB.');
+                addCause(ME, causeException);
+                throw(ME);
+            end
+            
+            % Return the string value
+            rmsg = pbuffer.Value;
+        end
+        
+        function rmsg = read(hid)
+            % Read from a hid device and returns the read bytes.
+            %
+            % Throws:
+            %     CommError: Error during communication with device
+            %     InvalidHandle: Handle to USB-device not valid
+            % 
+            % Notes: 
+            %     * Will print an error if no data was read.
+            %
+            
+            % Read buffer of nReadBuffer length
+            buffer = zeros(1,hid.nReadBuffer);
+            % Create a uint8 pointer
+            pbuffer = libpointer('uint8Ptr', uint8(buffer));
+            
+            % (MMI) Check if pointer is (unexpectedly) already invalidated
+            assert(isLibPointerValid(hid.handle)==1, ...
+                [hid.slib, ':', 'InvalidHandle'], ...
+                'Failed to read USB-data because pointer to USB-device is invalidated.');
+            
+            % Read data from HID device
+            [res,h] = calllib(hid.slib,'hid_read',hid.handle,pbuffer,uint64(length(buffer)));
+            
+            % (MMI) Check the response (No assert as there are multiple cases)
+            if res < 1
+                % Error occurred
+                id = [hid.slib, ':', 'CommError'];
+                % Narrow error down
+                if res == -1
+                    msg = 'Connection error (probably lost connection to device)';
+                elseif res == 0
+                    msg = ['Could not read data from device (device is still connected, ',...
+                           'but does not react)'];
+                else
+                    msg = 'Unexpected connection error';
+                end
+                causeException = MException(id, msg);
+                ME = MException(id, 'Failed to read data via USB.');
+                addCause(ME, causeException);
+                throw(ME);
+            end
+            
+            % Return the string value
+            rmsg = pbuffer.Value;
+        end
+        
+        function write(hid,wmsg,reportID)
+            % Write to a hid device.
+            %
+            % Throws:
+            %     CommError: Error during communication with device
+            %     InvalidHandle: Handle to USB-device not valid
+            %
+            % Notes: 
+            %     * Will print an error if there is a mismatch between the buffer size and the 
+            %       reported number of bytes written.
+            %
+            
+            % Append a 0 at the front for HID report ID
+            wmsg = [reportID wmsg];
+            
+            % Pad with zeros for nWriteBuffer length
+            % (MMI) Note:: The following line does not seem to be necessary;
+            % wmsg does not need to be the max packet size. Uncommenting this doesn't affect
+            % anything, and I would prefer sending short messages over long ones.
+            % Further testing may be required, so for now I don't change a thing.
+            % (MMI) Update:: Okay, so under Windows, this line IS necessary, as well as the
+            % fixed write-buffer size of 1025 bytes for EV3 (== wMaxPacketSize+1; smaller packets fail; 
+            % bigger packets do get handled by the brick, but the second assertion below will fail).
+            wmsg(end+(hid.nWriteBuffer-length(wmsg))) = 0;
+            
+            % Create a uint8 pointer
+            pbuffer = libpointer('uint8Ptr', uint8(wmsg));
+            
+            % (MMI) Check if pointer is (unexpectedly) already invalidated
+            assert(isLibPointerValid(hid.handle)==1, ...
+                [hid.slib, ':', 'InvalidHandle'], ...
+                'Failed to write to USB because pointer to USB-device is invalidated.');
+            
+            % Write the message
+            [res,h] = calllib(hid.slib,'hid_write',hid.handle,pbuffer,uint64(length(wmsg)));
+            
+            % (MMI) Check the response
+            assert(res == length(wmsg), ...
+                [hid.slib, ':', 'CommError'], ...
+                'Failed to write data via USB.');
+        end
+        
+        function str = getHIDInfoString(hid,info)
+            % Get the corresponding hid info from the hid device.
+            %
+            % Throws:
+            %     CommError: Error during communication with device
+            %     InvalidHandle: Handle to USB-device not valid
+            %
+            % Notes:
+            %     * Info is the hid information string. 
+            %
+            % See also HIDAPI.GETMANUFACTURERSSTRING, HIDAPI.GETPRODUCTSTRING,
+            % HIDAPI.GETSERIALNUMBERSTRING.
+            %
+            
+            % Read buffer nReadBuffer length
+            buffer = zeros(1,hid.nReadBuffer);
+            % Create a libpointer (depends on OS)
+            if (ispc == 1)
+                pbuffer = libpointer('uint16Ptr', uint16(buffer));
+            elseif ((ismac == 1) || (isunix == 1))
+                pbuffer = libpointer('int32Ptr', uint32(buffer));
+            end
+            
+            % (MMI) Check if pointer is (unexpectedly) already invalidated
+            assert(isLibPointerValid(hid.handle)==1, ...
+                [hid.slib, ':', 'InvalidHandle'], ...
+                'Failed to read USB-data because pointer to USB-device is invalidated.');
+            
+            % Get the HID info string
+            [res,h] = calllib(hid.slib,info,hid.handle,pbuffer,uint32(length(buffer)));
+            
+            % (MMI) Check the response
+            assert(res~=-1, ...
+                [hid.slib, ':', 'CommError'], ...
+                'Failed to read HID info string.');
+            
+            % Return the string value
+            str = sprintf('%s',char(pbuffer.Value));
+        end
+        
+        function setNonBlocking(hid,nonblock)
+            % Set the non blocking flag on the hid device connection.
+            %
+            % Arguments:
+            %     nonblock (numeric in {0,1}): 0 disables nonblocking, 1 enables nonblocking
+            %
+            % Throws:
+            %     CommError: Error during communication with device
+            %     InvalidHandle: Handle to USB-device not valid
+            %
+            
+            % (MMI) Check if pointer is (unexpectedly) already invalidated
+            assert(isLibPointerValid(hid.handle)==1, ...
+                [hid.slib, ':', 'InvalidHandle'], ...
+                'Failed to set USB-read-mode to non-blocking because pointer to USB-device is invalidated.');
+            
+            % Set non blocking
+            [res,h] = calllib(hid.slib,'hid_set_nonblocking',hid.handle,uint32(nonblock));
+            
+            % (MMI) Check the response
+            assert(res~=-1, ...
+                [hid.slib, ':', 'CommError'], ...
+                'Failed to set USB-read-mode to non-blocking.');
+        end
+        
+        function init(hid)
+            % Inits the hidapi library. 
+            %
+            % Throws:
+            %     CommError: Error during communication with device
+            %
+            % Notes:
+            %     * This is called automatically in the library itself with the open function. You 
+            %       should not have to call this function directly.
+            %
+            
+            warning([hid.slib, ':', 'RedundantCall'], ...
+                'The init-function gets called automatically when connecting!');
+            
+            % Init device
+            res = calllib(hid.slib,'hid_init');
+            
+            % (MMI) Check the response
+            assert(res~=-1, ...
+                [hid.slib, ':', 'CommError'], ...
+                'Failed to init USB-device.');
+        end
+        
+        function exit(hid)
+            %hidapi.exit Exit hidapi
+            %
+            % hid.exit() exits the hidapi library.
+            %
+            % Throws:
+            %     CommError: Error during communication with device
+            %
+            % Notes::
+            % - You should not have to call this function directly.
+            
+            warning([hid.slib, ':', 'RedundantCall'], ...
+                'The exit-function gets called automatically when disconnecting!');
+            
+            % Exit device
+            res = calllib(hid.slib,'hid_exit');
+            
+            % (MMI) Check the response
+            assert(res~=-1, ...
+                [hid.slib, ':', 'CommError'], ...
+                'Failed to exit USB-device.');
+        end
+        
+        function str = error(hid)
+            % Return the hid device error string if a function produced an error.
+            %
+            % Throws:
+            %     InvalidHandle: Handle to USB-device not valid
+            %
+            % Notes:
+            %     * This function must be called explicitly if you think an error was generated 
+            %       from the hid device.
+            % 
+            
+            % (MMI) Check if pointer is (unexpectedly) already invalidated
+            assert(isLibPointerValid(hid.handle)==1, ...
+                [hid.slib, ':', 'InvalidHandle'], ...
+                'Failed to read USB-error-data because pointer to USB-device is invalidated.');
+            
+            [~,str] = calllib(hid.slib,'hid_error',hid.handle);
+        end
+        
+        function str = enumerate(hid,vendorID,productID)
+            % Enumerates the info about the hid device with the given vendorID and productID 
+            % and returns a string with the returned hid information.
+            %
+            % Arguments:
+            %     vendorID (numeric): Vendor-ID of the USB device in decimal.
+            %     productID (numeric): Product-ID of the USB device in decimal. 
+            %
+            % Notes:
+            %     * Using a vendorID and productID of (0,0) will enumerate all connected hid 
+            %       devices.
+            %     * MATLAB does not have the hid_device_infoPtr struct so some of the returned 
+            %       information will need to be resized and cast into uint8 or chars.
+            %
+            
+            % Enumerate the hid devices
+            str = calllib(u.slib,'hid_enumerate',uint16(vendorID),uint16(productID));
+        end
+        
+        %% Wrapper 
+        
+        function str = getManufacturersString(hid)
+            % Get manufacturers string from hid object using getHIDInfoString.
+            str = getHIDInfoString(hid,'hid_get_manufacturer_string');
+        end
+        function str = getProductString(hid)
+            % Get product string from hid object using getProductString.
+            str = getHIDInfoString(hid,'hid_get_product_string');
+        end
+        function str = getSerialNumberString(hid)
+            % Get serial number from hid object using getSerialNumberString.
+            str = getHIDInfoString(hid,'hid_get_serial_number_string');
+        end
+    end
+end
+
+% Implemented @ MMI
+function valid = isLibPointerValid(handle)
+    % Check whether hid.handle is valid libpointer
+
+    valid = 0;
+    if ~isempty(handle)
+        if isa(handle, 'handle') && ~isNull(handle)
+            valid = 1;
+        end
+    end
+end
diff --git a/source/usbBrickIO.m b/source/usbBrickIO.m
old mode 100755
new mode 100644
index f4ce6c086a87a6e948eeeb0460246986be7a1d2b..0f7bbf1fcf536b4b8d8d8663636691ce02e94e45
--- a/source/usbBrickIO.m
+++ b/source/usbBrickIO.m
@@ -1,280 +1,280 @@
-classdef usbBrickIO < BrickIO
-    % USB interface between MATLAB and the brick
-    %
-    % Notes:
-    %     * Uses the hid library implementation in hidapi.m
-    %     * The default parameters should always work when you try to connect to an EV3 brick,
-    %       so in nearly all use-cases, the constructor does not need any parameters (besides
-    %       'debug' eventually).
-    %
-    % Attributes:
-    %     debug (bool): If true, each open/close/read/write-call will be noted in the console.
-    %        Defaults to false.
-    %     vendorID (numeric): Vendor-ID of the USB device. Defaults to 0x694 (EV3 vendor ID).
-    %     productID (numeric): Product-ID of the USB device. Defaults to 0x0005 (EV3 product ID).
-    %     nReadBuffer (numeric): Read-buffer size in bytes. Defaults to 1024.
-    %     nWriteBuffer (numeric): Write-buffer size in bytes. Needs to be 1 Byte bigger than
-    %        actual packet. Defaults to 1025 (EV3 USB maximum packet size = 1024).
-    %     timeOut (numeric >= 0): Milliseconds after which a timeout-error occurs if no packet could be
-    %        read. Defaults to 10000.
-    %
-    % Examples:
-    %    % Connecting via USB |br|
-    %    commHandle = usbBrickIO(); % |br|
-    %    % Connecting via USB with enabled debug output |br|
-    %    commHandle = usbBrickIO('debug', true); % |br|
-    %
-    
-    properties
-        % debug (bool): If true, each open/close/read/write-call will be noted in the console.
-        %    Defaults to false.
-        debug;
-        % vendorID (numeric): Vendor-ID of the USB device. Defaults to 0x694 (EV3 vendor ID).
-        vendorID;
-        % productID (numeric): Product-ID of the USB device. Defaults to 0x0005 (EV3 product ID).
-        productID;
-        % nReadBuffer (numeric): Read-buffer size in bytes. Defaults to 1024.
-        nReadBuffer;
-        % nWriteBuffer (numeric): Write-buffer size in bytes. Defaults to 1025 (EV3 USB maximum packet size = 1024).
-        %    Needs to be 1 Byte bigger than actual packet. 
-        nWriteBuffer;
-        % timeOut (numeric >= 0): Milliseconds after which a timeout-error occurs if no packet could be read. Defaults to 10000.
-        timeOut;
-    end
-    
-    properties (Access = protected)
-        % handle: Connection handle to the device
-        handle
-    end 
-    
-    methods
-        function brickIO = usbBrickIO(varargin)
-            % Create an usbBrickIO object 
-            %
-            % Arguments:
-            %     varargin: Any number of property names as strings, each followed by the
-            %         desired value. 
-            %
-            % Examples: 
-            %    % Connecting via USB 
-            %    commHandle = usbBrickIO();
-            %    % Connecting via USB with enabled debug output
-            %    commHandle = usbBrickIO('debug', true);
-            %
-            % See also USBBRICKIO.SETPROPERTIES
-            
-            brickIO.setProperties(varargin{:});
-            
-            if brickIO.debug > 0
-                fprintf('(DEBUG) (USB init)\n');
-            end
-            
-            % Set the connection handle
-            try
-                brickIO.handle = hidapi(brickIO.vendorID,brickIO.productID, ...
-                                        brickIO.nReadBuffer,brickIO.nWriteBuffer);
-            catch ME
-                if ~isempty(strfind(ME.identifier, 'InvalidParameterOrFileMissing'))
-                    % Throw a clean InvalidParameterOrFileMissing to avoid confusion in upper layers
-                    msg = ['Couldn''t load hidapi-library for USB connection due to a ' ...
-                           'missing file. Make sure the correct hidapi-library and its ' ...
-                           'corresponding thunk- and proto-files are available.'];
-                    id = [ID(), ':', 'InvalidParameterOrFileMissing'];
-                    throw(MException(id, msg));
-                elseif ~isempty(strfind(ME.identifier, 'LoadingLibraryError'))
-                    % Throw a clean LoadingLibraryError to avoid confusion in upper layers
-                    msg = 'Failed to load hidapi-library for USB connection.';
-                    id = [ID(), ':', 'LoadingLibraryError'];
-                    throw(MException(id, msg));
-                else
-                    % Throw combined error because error did not happen due to known reasons...
-                    msg = 'Unknown error occurred while trying to load the HIDAPI-lib for USB.';
-                    id = [ID(), ':', 'UnknownError'];
-                    newException = MException(id, msg);
-                    newException = addCause(newException, ME);
-                    throw(newException);
-                end
-            end
-                                
-            % Open the connection
-            brickIO.open;
-        end
-        
-        function delete(brickIO)
-            % Delete the usbBrickIO object and closes the connection
-            
-            if brickIO.debug > 0
-                fprintf('(DEBUG) (USB delete)\n');
-            end
-            
-            % Disconnect
-            try
-                brickIO.close;
-            catch
-                % Connection already closed (probably due to an error) - do nothing
-            end
-        end
-        
-        function open(brickIO)
-            % Opens the usb connection to the brick through the hidapi interface.
-            
-            if brickIO.debug > 0
-                fprintf('(DEBUG) (USB open)\n');
-            end
-            
-            % Open the usb handle 
-            try
-                brickIO.handle.open;
-            catch ME
-                if ~isempty(strfind(ME.identifier, 'CommError'))
-                    % Throw a clean CommError to avoid confusion in upper layers
-                    msg = 'Failed to open connection to Brick via USB.';
-                    id = [ID(), ':', 'CommError'];
-                    throw(MException(id, msg));
-                else
-                    % Throw combined error because error did not happen due to known reasons...
-                    msg = 'Unknown error occurred while trying to connect to the Brick via USB.';
-                    id = [ID(), ':', 'UnknownError'];
-                    newException = MException(id, msg);
-                    newException = addCause(newException, ME);
-                    throw(newException);
-                end
-            end
-        end
-        
-        function close(brickIO)
-            % Closes the usb connection the brick through the hidapi interface.
-            
-            if brickIO.debug > 0
-                fprintf('(DEBUG) (USB close) \n');
-            end 
-            
-            try
-                % Close the usb handle
-                brickIO.handle.close;
-            catch ME
-                % Throw combined error because error did not happen due to known reasons...
-                msg = 'Unknown error occurred while closing the USB connection.';
-                id = [ID(), ':', 'UnknownError'];
-                newException = MException(id, msg);
-                newException = addCause(newException, ME);
-                throw(newException);
-            end
-        end
-        
-        function rmsg = read(brickIO)
-            % Reads data from the brick through usb using the hidapi interface and returns the data in uint8 format.
-            
-            if brickIO.debug > 0
-                fprintf('(DEBUG) (USB read)   ');
-            end 
-            
-            % Read from the usb handle
-            try
-                if brickIO.timeOut ~= 0
-                    rmsg = brickIO.handle.read_timeout(brickIO.timeOut);
-                else
-                    rmsg = brickIO.handle.read();
-                end
-            catch ME
-                if ~isempty(strfind(ME.identifier, 'CommError'))
-                    % Throw a clean CommError to avoid confusion in upper layers
-                    msg = 'Failed to read data from the Brick via USB due to connection-error.';
-                    id = [ID(), ':', 'CommError'];
-                    throw(MException(id, msg));
-                elseif ~isempty(strfind(ME.identifier, 'InvalidHandle'))
-                    % Throw a clean InvalidHandle to avoid confusion in upper layers
-                    msg = 'Failed to read data from the Brick via USB due to invalid handle to USB-device.';
-                    id = [ID(), ':', 'InvalidHandle'];
-                    throw(MException(id, msg));
-                else
-                    % Throw combined error because error did not happen due to known reasons...
-                    msg = 'Unknown error occurred while reading data from the Brick via USB.';
-                    id = [ID(), ':', 'UnknownError'];
-                    newException = MException(id, msg);
-                    newException = addCause(newException, ME);
-                    throw(newException);
-                end
-            end
-            
-            % Get the number of read bytes
-            pLength = double(typecast(uint8(rmsg(1:2)),'uint16')) + 2;
-            
-            % Format the read message (2 byte length plus message)
-            if pLength < length(rmsg)
-                rmsg = rmsg(1:pLength);
-            end
-        end
-        
-        function write(brickIO,wmsg)
-            % Writes data to the brick through usb using the hidapi interface.
-            %
-            % Arguments:
-            %     wmsg (uint8 array): Data to be written to the brick via usb
-            
-            if brickIO.debug > 0
-                fprintf('(DEBUG) (USB write)  ');
-            end 
-            
-            % Write to the usb handle using report ID 0
-            try
-                brickIO.handle.write(wmsg,0);
-            catch ME
-                if ~isempty(strfind(ME.identifier, 'CommError'))
-                    % Throw a clean CommError to avoid confusion in upper layers
-                    msg = 'Failed to send data to Brick via USB due to connection-error.';
-                    id = 'RWTHMindstormsEV3:usbBrickIO:write:CommError';
-                    throw(MException(id, msg));
-                elseif ~isempty(strfind(ME.identifier, 'InvalidHandle'))
-                    % Throw a clean InvalidHandle to avoid confusion in upper layers
-                    msg = 'Failed to send data to Brick via USB due to invalid handle to USB-device.';
-                    id = [ID(), ':', 'InvalidHandle'];
-                    throw(MException(id, msg));
-                else
-                    % Throw combined error because error did not happen due to known reasons...
-                    msg = 'Unknown error occurred while sending data to the Brick via USB.';
-                    id = [ID(), ':', 'UnknownError'];
-                    newException = MException(id, msg);
-                    newException = addCause(newException, ME);
-                    throw(newException);
-                end
-            end
-        end
-        
-        function set.timeOut(brickIO, timeOut)
-            if ~isnumeric(timeOut) || timeOut < 0
-                error(ID(), 'timeOut-period of USB-handle can only be set to positive numerical values.'); 
-            end
-            
-            brickIO.timeOut = timeOut*1000;
-        end 
-        function setProperties(brickIO, varargin)
-            % Sets multiple usbBrickIO properties at once using MATLAB's inputParser.
-            %
-            % The syntax is as follows: commHandle.setProperties('propertyName1',
-            % propertyValue1, 'propertyName2', propertyValue2, ...). Valid, optional properties
-            % are: debug, vendorID, productID, nReadBuffer, nWriteBuffer, timeOut.
-            %
-            % See also USBBRICKIO.DEBUG, USBBRICKIO.VENDORID, USBBRICKIO.PRODUCTID,
-            % USBBRICKIO.NREADBUFFER, USBBRICKIO.NWRITEBUFFER, USBBRICKIO.TIMEOUT
-            
-            p = inputParser();
-            
-            p.addOptional('debug', false);
-            p.addOptional('vendorID', 1684);
-            p.addOptional('productID', 5);
-            p.addOptional('nReadBuffer', 1024);
-            p.addOptional('nWriteBuffer', 1025);
-            p.addOptional('timeOut', 10000);
-            
-            p.parse(varargin{:});
-            
-            brickIO.debug = p.Results.debug;
-            brickIO.vendorID = p.Results.vendorID;
-            brickIO.productID = p.Results.productID;
-            brickIO.nReadBuffer = p.Results.nReadBuffer;
-            brickIO.nWriteBuffer = p.Results.nWriteBuffer;
-            brickIO.timeOut = p.Results.timeOut;
-        end
-    end 
-end
+classdef usbBrickIO < BrickIO      
+    % USB interface between MATLAB and the brick
+    %
+    % Notes:
+    %     * Uses the hid library implementation in hidapi.m
+    %     * The default parameters should always work when you try to connect to an EV3 brick,
+    %       so in nearly all use-cases, the constructor does not need any parameters (besides
+    %       'debug' eventually).
+    %
+    % Attributes:
+    %     debug (bool): If true, each open/close/read/write-call will be noted in the console.
+    %        Defaults to false.
+    %     vendorID (numeric): Vendor-ID of the USB device. Defaults to 0x694 (EV3 vendor ID).
+    %     productID (numeric): Product-ID of the USB device. Defaults to 0x0005 (EV3 product ID).
+    %     nReadBuffer (numeric): Read-buffer size in bytes. Defaults to 1024.
+    %     nWriteBuffer (numeric): Write-buffer size in bytes. Needs to be 1 Byte bigger than
+    %        actual packet. Defaults to 1025 (EV3 USB maximum packet size = 1024).
+    %     timeOut (numeric >= 0): Milliseconds after which a timeout-error occurs if no packet could be
+    %        read. Defaults to 10000.
+    %
+    % Examples:
+    %    % Connecting via USB |br|
+    %    commHandle = usbBrickIO(); % |br|
+    %    % Connecting via USB with enabled debug output |br|
+    %    commHandle = usbBrickIO('debug', true); % |br|
+    %
+    
+    properties
+        % debug (bool): If true, each open/close/read/write-call will be noted in the console.
+        %    Defaults to false.
+        debug;
+        % vendorID (numeric): Vendor-ID of the USB device. Defaults to 0x694 (EV3 vendor ID).
+        vendorID;
+        % productID (numeric): Product-ID of the USB device. Defaults to 0x0005 (EV3 product ID).
+        productID;
+        % nReadBuffer (numeric): Read-buffer size in bytes. Defaults to 1024.
+        nReadBuffer;
+        % nWriteBuffer (numeric): Write-buffer size in bytes. Defaults to 1025 (EV3 USB maximum packet size = 1024).
+        %    Needs to be 1 Byte bigger than actual packet. 
+        nWriteBuffer;
+        % timeOut (numeric >= 0): Milliseconds after which a timeout-error occurs if no packet could be read. Defaults to 10000.
+        timeOut;
+    end
+    
+    properties (Access = protected)
+        % handle: Connection handle to the device
+        handle
+    end 
+    
+    methods
+        function brickIO = usbBrickIO(varargin)
+            % Create an usbBrickIO object 
+            %
+            % Arguments:
+            %     varargin: Any number of property names as strings, each followed by the
+            %         desired value. 
+            %
+            % Examples: 
+            %    % Connecting via USB 
+            %    commHandle = usbBrickIO();
+            %    % Connecting via USB with enabled debug output
+            %    commHandle = usbBrickIO('debug', true);
+            %
+            % See also USBBRICKIO.SETPROPERTIES
+            
+            brickIO.setProperties(varargin{:});
+            
+            if brickIO.debug > 0
+                fprintf('(DEBUG) (USB init)\n');
+            end
+            
+            % Set the connection handle
+            try
+                brickIO.handle = hidapi(brickIO.vendorID,brickIO.productID, ...
+                                        brickIO.nReadBuffer,brickIO.nWriteBuffer);
+            catch ME
+                if ~isempty(strfind(ME.identifier, 'InvalidParameterOrFileMissing'))
+                    % Throw a clean InvalidParameterOrFileMissing to avoid confusion in upper layers
+                    msg = ['Couldn''t load hidapi-library for USB connection due to a ' ...
+                           'missing file. Make sure the correct hidapi-library and its ' ...
+                           'corresponding thunk- and proto-files are available.'];
+                    id = [ID(), ':', 'InvalidParameterOrFileMissing'];
+                    throw(MException(id, msg));
+                elseif ~isempty(strfind(ME.identifier, 'LoadingLibraryError'))
+                    % Throw a clean LoadingLibraryError to avoid confusion in upper layers
+                    msg = 'Failed to load hidapi-library for USB connection.';
+                    id = [ID(), ':', 'LoadingLibraryError'];
+                    throw(MException(id, msg));
+                else
+                    % Throw combined error because error did not happen due to known reasons...
+                    msg = 'Unknown error occurred while trying to load the HIDAPI-lib for USB.';
+                    id = [ID(), ':', 'UnknownError'];
+                    newException = MException(id, msg);
+                    newException = addCause(newException, ME);
+                    throw(newException);
+                end
+            end
+                                
+            % Open the connection
+            brickIO.open;
+        end
+        
+        function delete(brickIO)
+            % Delete the usbBrickIO object and closes the connection
+            
+            if brickIO.debug > 0
+                fprintf('(DEBUG) (USB delete)\n');
+            end
+            
+            % Disconnect
+            try
+                brickIO.close;
+            catch
+                % Connection already closed (probably due to an error) - do nothing
+            end
+        end
+        
+        function open(brickIO)
+            % Opens the usb connection to the brick through the hidapi interface.
+            
+            if brickIO.debug > 0
+                fprintf('(DEBUG) (USB open)\n');
+            end
+            
+            % Open the usb handle 
+            try
+                brickIO.handle.open;
+            catch ME
+                if ~isempty(strfind(ME.identifier, 'CommError'))
+                    % Throw a clean CommError to avoid confusion in upper layers
+                    msg = 'Failed to open connection to Brick via USB.';
+                    id = [ID(), ':', 'CommError'];
+                    throw(MException(id, msg));
+                else
+                    % Throw combined error because error did not happen due to known reasons...
+                    msg = 'Unknown error occurred while trying to connect to the Brick via USB.';
+                    id = [ID(), ':', 'UnknownError'];
+                    newException = MException(id, msg);
+                    newException = addCause(newException, ME);
+                    throw(newException);
+                end
+            end
+        end
+        
+        function close(brickIO)
+            % Closes the usb connection the brick through the hidapi interface.
+            
+            if brickIO.debug > 0
+                fprintf('(DEBUG) (USB close) \n');
+            end 
+            
+            try
+                % Close the usb handle
+                brickIO.handle.close;
+            catch ME
+                % Throw combined error because error did not happen due to known reasons...
+                msg = 'Unknown error occurred while closing the USB connection.';
+                id = [ID(), ':', 'UnknownError'];
+                newException = MException(id, msg);
+                newException = addCause(newException, ME);
+                throw(newException);
+            end
+        end
+        
+        function rmsg = read(brickIO)
+            % Reads data from the brick through usb using the hidapi interface and returns the data in uint8 format.
+            
+            if brickIO.debug > 0
+                fprintf('(DEBUG) (USB read)   ');
+            end 
+            
+            % Read from the usb handle
+            try
+                if brickIO.timeOut ~= 0
+                    rmsg = brickIO.handle.read_timeout(brickIO.timeOut);
+                else
+                    rmsg = brickIO.handle.read();
+                end
+            catch ME
+                if ~isempty(strfind(ME.identifier, 'CommError'))
+                    % Throw a clean CommError to avoid confusion in upper layers
+                    msg = 'Failed to read data from the Brick via USB due to connection-error.';
+                    id = [ID(), ':', 'CommError'];
+                    throw(MException(id, msg));
+                elseif ~isempty(strfind(ME.identifier, 'InvalidHandle'))
+                    % Throw a clean InvalidHandle to avoid confusion in upper layers
+                    msg = 'Failed to read data from the Brick via USB due to invalid handle to USB-device.';
+                    id = [ID(), ':', 'InvalidHandle'];
+                    throw(MException(id, msg));
+                else
+                    % Throw combined error because error did not happen due to known reasons...
+                    msg = 'Unknown error occurred while reading data from the Brick via USB.';
+                    id = [ID(), ':', 'UnknownError'];
+                    newException = MException(id, msg);
+                    newException = addCause(newException, ME);
+                    throw(newException);
+                end
+            end
+            
+            % Get the number of read bytes
+            pLength = double(typecast(uint8(rmsg(1:2)),'uint16')) + 2;
+            
+            % Format the read message (2 byte length plus message)
+            if pLength < length(rmsg)
+                rmsg = rmsg(1:pLength);
+            end
+        end
+        
+        function write(brickIO,wmsg)
+            % Writes data to the brick through usb using the hidapi interface.
+            %
+            % Arguments:
+            %     wmsg (uint8 array): Data to be written to the brick via usb
+            
+            if brickIO.debug > 0
+                fprintf('(DEBUG) (USB write)  ');
+            end 
+            
+            % Write to the usb handle using report ID 0
+            try
+                brickIO.handle.write(wmsg,0);
+            catch ME
+                if ~isempty(strfind(ME.identifier, 'CommError'))
+                    % Throw a clean CommError to avoid confusion in upper layers
+                    msg = 'Failed to send data to Brick via USB due to connection-error.';
+                    id = 'RWTHMindstormsEV3:usbBrickIO:write:CommError';
+                    throw(MException(id, msg));
+                elseif ~isempty(strfind(ME.identifier, 'InvalidHandle'))
+                    % Throw a clean InvalidHandle to avoid confusion in upper layers
+                    msg = 'Failed to send data to Brick via USB due to invalid handle to USB-device.';
+                    id = [ID(), ':', 'InvalidHandle'];
+                    throw(MException(id, msg));
+                else
+                    % Throw combined error because error did not happen due to known reasons...
+                    msg = 'Unknown error occurred while sending data to the Brick via USB.';
+                    id = [ID(), ':', 'UnknownError'];
+                    newException = MException(id, msg);
+                    newException = addCause(newException, ME);
+                    throw(newException);
+                end
+            end
+        end
+        
+        function set.timeOut(brickIO, timeOut)
+            if ~isnumeric(timeOut) || timeOut < 0
+                error(ID(), 'timeOut-period of USB-handle can only be set to positive numerical values.'); 
+            end
+            
+            brickIO.timeOut = timeOut*1000;
+        end 
+        function setProperties(brickIO, varargin)
+            % Sets multiple usbBrickIO properties at once using MATLAB's inputParser.
+            %
+            % The syntax is as follows: commHandle.setProperties('propertyName1',
+            % propertyValue1, 'propertyName2', propertyValue2, ...). Valid, optional properties
+            % are: debug, vendorID, productID, nReadBuffer, nWriteBuffer, timeOut.
+            %
+            % See also USBBRICKIO.DEBUG, USBBRICKIO.VENDORID, USBBRICKIO.PRODUCTID,
+            % USBBRICKIO.NREADBUFFER, USBBRICKIO.NWRITEBUFFER, USBBRICKIO.TIMEOUT
+            
+            p = inputParser();
+            
+            p.addOptional('debug', false);
+            p.addOptional('vendorID', 1684);
+            p.addOptional('productID', 5);
+            p.addOptional('nReadBuffer', 1024);
+            p.addOptional('nWriteBuffer', 1025);
+            p.addOptional('timeOut', 10000);
+            
+            p.parse(varargin{:});
+            
+            brickIO.debug = p.Results.debug;
+            brickIO.vendorID = p.Results.vendorID;
+            brickIO.productID = p.Results.productID;
+            brickIO.nReadBuffer = p.Results.nReadBuffer;
+            brickIO.nWriteBuffer = p.Results.nWriteBuffer;
+            brickIO.timeOut = p.Results.timeOut;
+        end
+    end 
+end