tag:blogger.com,1999:blog-21830494854015724272024-03-21T21:16:15.711-07:00Marco's BlogDeveloper blog by Marco ScholtyssekAnonymoushttp://www.blogger.com/profile/15726432233249362681noreply@blogger.comBlogger7125tag:blogger.com,1999:blog-2183049485401572427.post-86444788882471242832014-11-24T07:43:00.000-08:002015-01-14T11:58:25.515-08:00TSL2561 light sensor with STM32F4<div style="text-align: justify;">
This blog has been moved: <a href="http://scholtyssek.org/blog/2014/11/24/tsl2561-light-sensor-with-stm32f4/">http://scholtyssek.org/blog/2014/11/24/tsl2561-light-sensor-with-stm32f4/</a><br />
<br />
The TSL2561 is a sensor that measures the light-intensity and transforms it to a 16-bit resolution digital value. There are two photodiodes on the sensor, one to sense the light intensity plus infrared light and a second one to measure only infrared light. These two photodiodes convert the measured light-intensity simultaneously. There are two channels available on the sensor to transfer the values into the data register (channel 0 and channel 1). The idea is to subtract the infrared part of the light, so that the resulting light spectrum is the human seeable light.</div>
<div style="text-align: justify;">
The measured data can be received via I2C or SMBus. In this article the I2C bus will be for the communicatation between the STM32F4 and the with the TSL2561. </div>
<div style="text-align: justify;">
<br /></div>
<h3 style="text-align: justify;">
Connect the device</h3>
<div style="text-align: justify;">
The TSL2561 works with <b><span style="color: red;">3.8V</span></b>, don't use the 5V pin, you may destroy the sensor. Futher there are two pins (SDA and SCL) for the I2C bus communication. The SDA is the data line, while SCL is the clock. The address pin is to set a unique I2C bus address. The default address can be used, unless there is another device with the same address on the bus. The default address is <b>0x39</b>, but it can also be set to 0x29 or 0x49. The sensor can generate an interrupt, so that it is not necessary to poll the device. In this example the interrupt signal is not used.</div>
<div style="text-align: justify;">
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEil1L9X25C1DC50LuFQl7_VN_cWXUnXjj2mcByuQqbHiZt6cxgFOUfa5MatX8Gvf1emGt_6XJiRDv5e3I65iqJ6sEovo9n74TUukef9JG1R07DUPYPJaBf4HUg2AswKFN9T1Ud2j3xQsCDY/s1600/tsl2561.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEil1L9X25C1DC50LuFQl7_VN_cWXUnXjj2mcByuQqbHiZt6cxgFOUfa5MatX8Gvf1emGt_6XJiRDv5e3I65iqJ6sEovo9n74TUukef9JG1R07DUPYPJaBf4HUg2AswKFN9T1Ud2j3xQsCDY/s1600/tsl2561.jpg" height="400" width="340" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">TSL2561 light sensor</td></tr>
</tbody></table>
<h3 style="text-align: justify;">
The software part</h3>
<div>
The STM32F4 controller has several I2C interfaces. The example implementation uses the I2C1, which is connected to GPIO6 (SCL) and GPIO7 (SDA). The configuration is encapsulated to an configuration header, so it is easy to change the bus. <span style="text-align: justify;">The software can be downloaded from the </span><a href="https://code.google.com/p/scholtyssek-blogspot/" style="text-align: justify;" target="_blank">repository</a><span style="text-align: justify;"> (the project is called TSL2561_example). </span>The maximum clock frequency for the device is 400kHz, so this frequency is set in the configuration file. The <i>init_lightsensor(void)</i> method is the configures the necessary IOs and the I2C communication via <i>initLightSensorI2C(void)</i>.</div>
<div>
To read the measured values, there are four register (two for every channel), that can be read. First there is a 8 bit register that contains the values low byte an then there is a second register for the high byte.</div>
<br />
<center>
<table style="border: 1px solid black; text-align: center; width: 100%;"><tbody>
<tr> <th style="text-align: center;">address<br />
<span style="font-weight: normal;">0x00</span></th> <th>description<br />
<span style="font-weight: normal;">control register</span></th> </tr>
<tr> <td>0x8C</td> <td>low byte (channel0)</td> </tr>
<tr> <td>0x8D</td> <td>high byte (channel0)</td> </tr>
<tr> <td>0x8E</td> <td>low byte (channel1)</td> </tr>
<tr> <td>0x8F</td> <td>high byte (channel1)</td> </tr>
</tbody></table>
<div style="text-align: start;">
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
To read bytes from the device registers, the requested register addresses should be send bytewise to the control register (0x00). There is a command bit that must be set so that the device reacts on the request. </div>
<div style="text-align: justify;">
The received data can be calculated to the SI unit <a href="http://en.wikipedia.org/wiki/Lux" target="_blank">LUX</a>. This calculation is already implemented in the example code. The <i>read_lightness_value() </i>method receives the data bytes via I2C and processes the calculation to LUX.</div>
<div style="text-align: justify;">
<br /></div>
<h3 style="text-align: justify;">
Appendix</h3>
<div>
<div style="text-align: left;">
http://www.adafruit.com/datasheets/TSL2561.pdf</div>
</div>
</div>
</center>
Anonymoushttp://www.blogger.com/profile/15726432233249362681noreply@blogger.com0tag:blogger.com,1999:blog-2183049485401572427.post-41789360699040006592014-11-21T09:05:00.000-08:002015-01-14T11:59:28.568-08:00STM32F4 with ERIKA Enterprise RTOS OSEK<div style="text-align: justify;">
This blog has been moved: <a href="http://scholtyssek.org/blog/2014/11/21/stm32f4-with-erika-enterprise-rtos-osek/">http://scholtyssek.org/blog/2014/11/21/stm32f4-with-erika-enterprise-rtos-osek/</a><br />
<br />
<a href="http://erika.tuxfamily.org/drupal/">Erika Enterprise</a> is an open source OSEK compliant real time operating system (RTOS) that support the STM32F4-Discovery controller. There is a eclipse tool chain integration available, so it is possible to develop software directly in this IDE. Combined with the <a href="http://sourceforge.net/projects/gnuarmeclipse/" target="_blank">GNU ARM Eclipse Plugin</a>, the <a href="https://github.com/texane/stlink" rel="" target="_blank">stlink</a> debugger and programmer and the <a href="https://launchpad.net/gcc-arm-embedded/+download" target="_blank">GNU Tools for ARM Embedded Processors</a>, eclipse is a great tool for developing, flashing and in-circuit-debugging applications based on the ERIKA real time kernel for STM32F4 devices. The OS can be downloaded <a href="http://erika.tuxfamily.org/drupal/download.html" target="_blank">here</a>, if there are any questions about the installation, please have a look at the wiki or the forum on the ERIKA website. </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
The OS comes with an oil-file, which is a configuration file for the kernel. In this file, there are several options to config the kernel and to define dependencies for used libraries, e.g. the Cortex Microcontroller Software Interface Standard (CMSIS).</div>
<div style="text-align: justify;">
The ERIKA kernel supports several classes of tasks (basic and extended tasks). Compared to the basic tasks, the extended tasks support synchronization via system events. This nice feature allows to activate a task by sending an event within the software. To learn more about the operating system, please have a look at the official <a href="http://erika.tuxfamily.org/drupal/documentation.html" target="_blank">documentation</a>.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
The following section describes the usage of ERIKA Enterprise with extended tasks and event based scheduling on the STM32F4 controller. To use this kernel configuration, there are some necessary options that can be set in the oil-file. A configuration for the controller looks like this:</div>
<br />
<pre style="background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; width: 646.46875px;"><code style="word-wrap: normal;">CPU mySystem {
OS myOs {
CPU_CLOCK = 168.0;
MODEL = M4;
APP_SRC = "src/code.c";
APP_SRC = "src/pwm.c";
COMPILER_TYPE = GNU;
MULTI_STACK = TRUE {
IRQ_STACK = TRUE {
SYS_SIZE = 512;
};
};
EE_OPT = "DEBUG";
CFLAGS = "-std=c99";
};
MCU_DATA = STM32 {
MODEL = STM32F4xx;
};</code></pre>
<br />
<div style="text-align: justify;">
The STM32F4-Discovery has an ARM Cortex-M4 cpu which works with a frequency of 168 MHz, so the CPU_CLOCK parameter is set to an appropriate value. The cpu clock depends on the exact model, in this example I used the STM32F407VG. The APP_SRC parameter is used to list every *.c file that should be compiled with the kernel. To use multiple files, the parameter can be repeated. The development is based on the GNU ARM compiler and debugger, so the <span style="text-align: start;">COMPILER_TYPE</span> is used to declare the GNU toolchain. To use extended tasks, it is necessary to specify a MULTI_STACK and with a static size. The last block defines the CPU model. It is set to the STM32F4 processor family.</div>
<div style="text-align: justify;">
To integrate external libraries, like the ARM specific CMSIS, there is a possibility to add some libraries to the kernel. The following configuration shows how to defines the usage of the additional libraries:</div>
<br />
<pre style="background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; width: 646.46875px;"><code style="word-wrap: normal;">EE_OPT = "__USE_CMSIS_ALL__";
EE_OPT = "__USE_SPD_ALL__";
EE_OPT = "__USE_SYSTICK__";
EE_OPT = "__ADD_LIBS__";
LIB = ENABLE {
NAME = "ST_CMSIS";
};
LIB = ENABLE {
NAME = "STM32F4XX_SPD";
STM32F4XX_SPD = ENABLE {
USETIM = TRUE;
USEI2C = TRUE;
USEMISC = TRUE;
USESPI = TRUE;
USEUSART = TRUE;
};
};
LIB = ENABLE {
NAME = "STM32F4_DISCOVERY";
};</code></pre>
<br />
<div style="text-align: justify;">
These parameter are processor specific for the STM32F4 controller. The next configuration part describes the options to configure the ERIKA kernel scheduling. The kernel supports four <i>conformance classes</i>, that can be set (BCC1, BCC2, ECC1, ECC2). The BCC classes support basic tasks during the ECC classes support extended tasks. Extended tasks are necessary for event driven scheduling. To read more about the conformance classes, please have a look at the ERIKA <a href="http://erika.tuxfamily.org/drupal/documentation.html" target="_blank">reference manual</a>. The conformance class can be set with the following parameter:</div>
<br />
<pre style="background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; width: 646.46875px;"><code style="word-wrap: normal;">KERNEL_TYPE = ECC1;
</code></pre>
<br />
<div style="text-align: justify;">
The next step is to configure events and tasks. In this example there will be one task that is triggered by one event. This task will be called <i>setPwmTask</i> and it reacts on a <i>pwmEvent</i>. Tasks can react on a set of events, these have to be assigned in the configuration file. Accordingly a configuration for one task that reacts on one event looks like this:</div>
<br />
<pre style="background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; width: 646.46875px;"><code style="word-wrap: normal;">EVENT pwmEvent {
MASK = AUTO;
};
TASK setPwmTask {
PRIORITY = 0x03; /* lower priority */
AUTOSTART = FALSE;
STACK = PRIVATE {
SYS_SIZE = 512;
};
ACTIVATION = 1; /* only one pending activation */
SCHEDULE = FULL;
EVENT = pwmEvent;
};
</code></pre>
<br />
<div style="text-align: justify;">
The next step is to declare them in the implementation, so that it could be activated by the software:</div>
<div style="text-align: justify;">
<br /></div>
<pre style="background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; width: 646.46875px;"><code style="word-wrap: normal;">DeclareTask(setPwmTask);
DeclareEvent(pwmEvent);
TASK( setPwmTask) {
EventMaskType current;
while (1) {
if(WaitEvent(pwmEvent) == E_OK){
/* error handling */
}
getEvent(setPwmTask, &current); /* save event */
ClearEvent(pwmEvent);
/* do some fancy task work */
}
TerminateTask(); // never reached
}</code></pre>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
The last step is the initialization of the kernel. After this, the task can be activated by setting the pwmEvent event. The following snippet shows how to initialize the kernel and then activate the setPwmTask periodically:</div>
<br />
<pre style="background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; width: 646.46875px;"><code style="word-wrap: normal;">#include "ee.h"
#include "ee_api.h"
#include "kernel/oo/inc/ee_oo_api.h"
int main(void) {
/* Initialize Erika related stuff */
EE_system_init();
while (1) {
SetEvent(setPwmTask, pwmEvent);
Delay(MILLISECONDS_TO_TICKS(100, SystemCoreClock));
}
}</code></pre>
<br />
<div style="text-align: justify;">
With ERIKA Enterprise comes a very nice open source real-time OS that can easily be integrated in the eclipse IDE. It runs on the STM32F4-Discovery controller, so that all the nice features of a RTOS are available.</div>
Anonymoushttp://www.blogger.com/profile/15726432233249362681noreply@blogger.com1tag:blogger.com,1999:blog-2183049485401572427.post-5336840794094813402014-08-24T13:37:00.000-07:002015-01-14T12:07:34.611-08:00SRF02 ultrasonic sensor with STM32F4-DiscoveryThis blog has been moved: <a href="http://scholtyssek.org/blog/2014/08/24/srf02-ultrasonic-sensor-with-stm32f4-discovery/">http://scholtyssek.org/blog/2014/08/24/srf02-ultrasonic-sensor-with-stm32f4-discovery/</a><br />
<br />
The SRF02 Ultrasonic range finder is a ultrasonic distance sensor, which is a transceiver with only one membrane. That's practical, because the sensor is very small and so it is perfect for small sized hardware applications. It detects distances from 16 to 6000 cm. The Sensors needs a 5 V source, so it can be directly connected to many microcontroller. It communicates through serial interface or through i²c bus (also I2C bus called). The following article describes how to connect and use the sensor with a STM32F4 through I2C. The databus is very handy because it needs only two wires (SDA and SCL) for communication. SDA is the data wire and SCL is the clock. Components can be distinguished by a unique I2c address. In this example there are four SRF02 sensors on one bus. The configuration of the address will be described too. The I2C master is a ARM based STM32F4-Discovery (STM32F407VG) controller.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9PnsD_qBWEZeRDR7GYvABm1pFV6Mdtd3dJ3yD_3UyhuZHUPl_np_gkFPcsrJ1etWx6XGpbNqjWkJV7fotOE33mADHYYFsFZNbUkpH9oUYxm5S-KfeKx_xTI3FYjqYdOcT_2Vq_uu3LBA/s1600/front.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9PnsD_qBWEZeRDR7GYvABm1pFV6Mdtd3dJ3yD_3UyhuZHUPl_np_gkFPcsrJ1etWx6XGpbNqjWkJV7fotOE33mADHYYFsFZNbUkpH9oUYxm5S-KfeKx_xTI3FYjqYdOcT_2Vq_uu3LBA/s1600/front.jpg" height="172" width="320" /></a></div>
<a name='more'></a><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjj__6XqtONGjXbNEBGmq0wHYBkJYnVtvlBXVbQkO28PSO3a_GA1DNlI1EzJb-upVjBz_2QpXcIUvhi_Gr9YXPhzO_onJgN9KTr4cgGO6YhYuPGNjCUCqrYkMIJuRr91DZaHKyMLru2dBA/s1600/back.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjj__6XqtONGjXbNEBGmq0wHYBkJYnVtvlBXVbQkO28PSO3a_GA1DNlI1EzJb-upVjBz_2QpXcIUvhi_Gr9YXPhzO_onJgN9KTr4cgGO6YhYuPGNjCUCqrYkMIJuRr91DZaHKyMLru2dBA/s1600/back.jpg" height="221" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiajjsagbgyDJ1pTB14Qs2WTohWywR6CrnLIisP5lol9y49tDvGScTALVrRQixKeKZzkBKrI1WUH7CX0fNcIP-vU7B3uEb8kd4iUIgFxwKbqid0Un1soyj6G-DPaCowEuDZWPMztf0ymH4/s1600/side.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiajjsagbgyDJ1pTB14Qs2WTohWywR6CrnLIisP5lol9y49tDvGScTALVrRQixKeKZzkBKrI1WUH7CX0fNcIP-vU7B3uEb8kd4iUIgFxwKbqid0Un1soyj6G-DPaCowEuDZWPMztf0ymH4/s1600/side.jpg" height="320" width="305" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<h3>
SRF02 Basics</h3>
<div>
The SRF02 measures distances with ultrasonic signals. Therefore the sensor sends a short echo impulse through the membrane and afterwards it detects the reflection of the signal. The sensor also measures the time. The speed of sonic is constant, so the distance can be calculated with the time between sending the signal and detecting the reflection. This procedure is called <a href="http://en.wikipedia.org/wiki/Time_of_flight" target="_blank">time-of-flight</a>. </div>
<div>
The SRF02 must not be calibrated, this was already done by the manufacturer. The sensor provides three different units which can be configured. The following table shows the configurations for the different configuration:</div>
<br />
<center>
<table style="border: 1px solid black; text-align: center; width: 100%;"><tbody>
<tr 100="" 1px="" black="" border:="" center="" solid="" style="aus: <br /> <br /> <table style=; font-wight: bold;" text-align:="" width:=""> </tr>
</tbody><tbody>
<tr> <th>address</th> <th>function</th> </tr>
<tr> <td>0x50</td> <td>measured data in inch</td> </tr>
<tr> <td>0x51</td> <td>measured data in cm</td> </tr>
<tr> <td>0x52</td> <td>measured data in microseconds</td> </tr>
<tr> </tr>
<tr> </tr>
<tr><td>0x56</td> <td>fake range mode (inch)</td> </tr>
<tr> <td>0x57</td> <td>fake range mode (cm)</td></tr>
<tr> <td>0x58</td> <td>fake range mode (microseconds)</td> </tr>
<tr></tr>
<tr> <td>0xA0</td> <td>1. sequence to set the I2C address</td> </tr>
<tr><td>0xA5</td> <td>2. sequence to set the I2C address</td> </tr>
<tr><td>0xAA</td> <td>3. sequence to set the I2C address</td> </tr>
</tbody></table>
</center>
<br />
<h3>
Setting an unique I2C address</h3>
<div>
The addresses of the sensors are transferred as hexadecimal bytes. Initially, every sensor has the same address <b>0xE0</b>. If there is only one sensor on the bus, there is no need to change the address, but if there are a few of these sensors, the address has to be changed to an unique one. The new address has to be transferred to the command register of the sensor (0x00). To change the address, the sensor has to get into a mode, where it receives and saves the new address. So, there are three control bytes (1. - 3 sequence) which has to be transmitted. The new address will stay saved on the sensor, even if it's switched off.</div>
The sensor shows it's address while starting. There is a LED, which flashes the saved address with short impulses. When the sensor is switched on, is flashes the LED once (long impulse). After this, the sensor flashes the address as short impulses. For example, with the address 0xE0 the sensor will not give short impulses, but with the address 0xF0 it will flash eight times. The mapping of the addresses and the signals can be found in the following table:<br />
<br />
<div style="text-align: center;">
<br /></div>
<center>
<table style="border: 1px solid black; text-align: center; width: 100%;"><tbody>
<tr> <th style="text-align: center;">address</th> <th>flashes</th> </tr>
<tr> <td>0xE0</td> <td>0</td> </tr>
<tr> <td>0xE2</td> <td>1</td> </tr>
<tr> <td>0xE4</td> <td>2</td> </tr>
<tr> <td>0xE6</td> <td>3</td> </tr>
<tr> <td>0xE8</td> <td>4</td> </tr>
<tr> </tr>
<tr> <td>0xEA</td> <td>5</td> </tr>
<tr> <td>0xEC</td> <td>6</td> </tr>
<tr> <td>0xEE</td> <td>7</td> </tr>
<tr> <td>0xF0</td> <td>8</td> </tr>
<tr> <td>0xF2</td> <td>9</td> </tr>
<tr> <td>0xF4</td> <td>10</td> </tr>
<tr> <td>0xF6</td> <td>11</td> </tr>
<tr> <td>0xF8</td> <td>12</td> </tr>
<tr> <td>0xFA</td> <td>13</td> </tr>
<tr> <td>0xFC</td> <td>14</td> </tr>
<tr> <td>0xFE</td> <td>15</td> </tr>
</tbody></table>
</center>
<br />
In the <a href="https://code.google.com/p/scholtyssek-blogspot/" target="_blank">repository</a> (project: <b>SRF02_example</b>) there is an implementation to change the sensor address. Because of the fact that the all of the SRF02 sensors have the same initial address, it is necessary to change the address successively. The address change can be done with the function <i>setSensorI2CAddress(). </i>The function requires only the current and the new I2C address. An example implementation looks like this:<br />
<br />
<pre style="background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; width: 646.46875px;"><code style="word-wrap: normal;">#include "SRF02.h"
int main(int argc, char **argv) {
uint8_t address = 0x00;
initSRF02();
while(1){
initUltrasonicSensorI2C(SENSOR1_ADDRESS);
setSensorI2CAddress(SENSOR1_ADDRESS, 0xF0);
}
}</code></pre>
<br />
<br />
<h3>
Connect the sensor with STM32F4</h3>
The example code in the <a href="https://code.google.com/p/scholtyssek-blogspot/" target="_blank">repository</a> shows how to configure and connect the sensor with the STM32F4 controller. It can be found in the directory <b>SRF02_example</b>. The project uses four sensors in total. First the I2C bus is initialized with the function <i>initSRF02()</i>. After this, every sensor gets initialized by a call of <i>initUltrasonicSensorI2C()</i> which expect the sensor's I2C address. This function sets the measured unit additionally. Then the distance can be measured by the <i>readDistance() </i>function. The following code snippet is an example implementation to read the distance by one sensor:<br />
<br />
<br />
<pre style="background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); height: auto; overflow: auto; padding: 0px; width: 646.46875px;"><span style="font-size: 12px; line-height: 20px;">#include "SRF02.h"
uint16_t distance[4];
uint16_t minimumRange[4];
int main(int argc, char **argv) {
uint8_t address = 0x00;
initSRF02();
/* receive sensor data */
while (1) {
initUltrasonicSensorI2C(</span><span style="font-size: 12px; line-height: 20px;">SENSOR1_ADDRESS</span><span style="font-size: 12px; line-height: 20px;">);</span>
<span style="font-size: 12px; line-height: 20px;"> distance[i] = readDistance(</span><span style="font-size: 12px; line-height: 20px;">SENSOR1_ADDRESS</span><span style="font-size: 12px; line-height: 20px;">);</span><span style="font-size: 12px; line-height: 20px;">
}
}</span></pre>
<div>
<code style="word-wrap: normal;"><br /></code></div>
<h3>
Anhang</h3>
<div>
<a href="http://www.robot-electronics.co.uk/datasheets/t400s16.pdf" rel="nofollow" target="_blank">datasheet</a><br />
<br />
supplier: <a href="http://www.exp-tech.de/Sensoren/SRF02-Ultraschall-Entfernungssensor.html" rel="nofollow" target="_blank">exp-tech</a><br />
<br />
<br />
<br />
<br />
<br />
<br /></div>
Anonymoushttp://www.blogger.com/profile/15726432233249362681noreply@blogger.com0tag:blogger.com,1999:blog-2183049485401572427.post-40351183336913251262014-08-16T16:39:00.000-07:002015-01-14T12:03:59.455-08:00Xbox360 controller C integration<div style="text-align: justify;">
<span style="font-family: inherit;">This blog has been moved: </span><a href="http://scholtyssek.org/blog/2014/08/16/xbox360-controller-c-integration/">http://scholtyssek.org/blog/2014/08/16/xbox360-controller-c-integration/</a><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;">Today I have written some simple example code to integrate a Xbox360 controller into a C-based program. It reads the values of the controller axis and the buttons and displays them on the screen. The following picture shows the output of the code:</span></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6lKXjwChfWTaJXa0r0_zgg5eEsPTWZ4rcuGJ3gHsi36YYmM0QYb2cBDgYAnARZ0SmGB5dUU0qx7M4MfP-TpIKNYLK93TcWK9jPj2x1CuMIttAlRvPsKWvKO1_q3x-RwHGj2vXBb2fv3I8/s1600/xboxControllerOutput.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6lKXjwChfWTaJXa0r0_zgg5eEsPTWZ4rcuGJ3gHsi36YYmM0QYb2cBDgYAnARZ0SmGB5dUU0qx7M4MfP-TpIKNYLK93TcWK9jPj2x1CuMIttAlRvPsKWvKO1_q3x-RwHGj2vXBb2fv3I8/s1600/xboxControllerOutput.png" height="140" width="640" /></a></div>
<br />
<div style="text-align: justify;">
<span style="font-family: inherit;">In this case the buttons "A" and "TL", which is the top left button, were pressed. The project is called <i>xboxControllerClient</i> can be downloaded from my repository at <a href="https://code.google.com/p/scholtyssek-blogspot/">https://code.google.com/p/scholtyssek-blogspot/</a>.</span></div>
<div style="text-align: justify;">
<span style="font-family: inherit;"></span><br /></div>
<a name='more'></a><span style="font-family: inherit;"><br />
</span> <br />
<div style="text-align: justify;">
<span style="font-family: inherit;"><span style="font-family: inherit;">The whole configuration is in the header file </span><i style="font-family: inherit;">xboxController.h</i><span style="font-family: inherit;">. There the mapping of the buttons and the axis is implemented. The data will be stored in a struct called </span><i style="font-family: inherit;">xboxCtrl</i><span style="font-family: inherit;">. It is also is in the header file . The following example shows how to use the code:</span></span></div>
<span style="font-family: inherit;"> </span> <br />
<pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;">#include <stdlib.h>
#include "xboxController.h"
int main(int argc, char **argv) {
if (initXboxContoller(XBOX_DEVICE) >= 0) {
xboxCtrl* xbox = getXboxDataStruct();
readXboxControllerInformation(xbox);
printf("xbox controller detected\n\naxis:\t\t%d\nbuttons:\t%d\nidentifier:\t%s\n",
xbox->numOfAxis, xbox->numOfButtons, xbox->identifier);
while (1) {
readXboxData(xbox);
printXboxCtrlValues(xbox);
}
deinitXboxController(xbox);
}
return 0;
}
</code></pre>
<br />
<div style="text-align: justify;">
<span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div>
<div style="text-align: justify;">
<span style="font-family: inherit;">The method <i>initXboxContoller(XBOX_DEVICE)</i> opens a connection to the device /dev/input/js0. This device is set as the default device. To change this, change the value of <i>XBOX_DEVICE</i>. Next, the method <i>getXboxDataStruct()</i> returns a pointer to the data stuct <i>xboxCtrl. </i>In this struct, all informations are strored. You can update the informations with a periodic call of <i>readXboxData(xbox).</i> To print the state of the XBox controller, you should call<i> printXboxCtrlValues(xbox)</i>. </span><span style="font-family: Georgia, 'Times New Roman', serif;">That's it, happy coding :-)</span></div>
</div>
Anonymoushttp://www.blogger.com/profile/15726432233249362681noreply@blogger.com0tag:blogger.com,1999:blog-2183049485401572427.post-29576687679819344342014-07-29T11:58:00.003-07:002015-01-14T12:04:23.876-08:00Rigol DS1052D and Open Logic Sniffer This blog has been moved: <a href="http://scholtyssek.org/blog/2014/07/29/rigol-ds1052d-and-open-logic-sniffer/">http://scholtyssek.org/blog/2014/07/29/rigol-ds1052d-and-open-logic-sniffer/</a><br />
<br />
Today I have tested the logic analyzer of the Rigol DS1052D oscilloscope and I noticed that the LA does not interprete the measured signals. The Rigol DS1052D is a lower priced model, so it is ok that the data is not interpreted by the oscilloscope. But it is possible to export the signals and process them on a PC with the open source tool <a href="http://www.lxtreme.nl/ols">Open Logic Sniffer</a>. To do so you can export them as a CSV datafile. After an easy converting the data can be read by OLS. The following step describe what you have to do.<br />
<br />
<br />
<h3>
<div class="separator" style="clear: both; font-size: medium; font-weight: normal; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUVubeU7OlckvKv5W8We2eWkLrWQjYfZjHmc7g-5A9s-YZdhdCdb1XmyR6P4m-KT4iCozlGf8YqUbvXB60pj_dSsNELI8LaQ2oOjj_vrj7i-E0P844DjC6UirfDlCO8JL0JGxzqA12tKw/s1600/rigol.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUVubeU7OlckvKv5W8We2eWkLrWQjYfZjHmc7g-5A9s-YZdhdCdb1XmyR6P4m-KT4iCozlGf8YqUbvXB60pj_dSsNELI8LaQ2oOjj_vrj7i-E0P844DjC6UirfDlCO8JL0JGxzqA12tKw/s1600/rigol.jpg" height="308" width="640" /></a></div>
<div style="font-size: medium; font-weight: normal;">
<br /></div>
<div>
<br />
<a name='more'></a><br /></div>
</h3>
<h3>
1. Save and export the samples</h3>
<div>
<br /></div>
<div>
With the "RUN/STOP" button it is possible to freeze the current measurement. Then the samples can be saved on a USB device. For this, you can push the "Storage" button and select the menu entry "External". This entry will only be enabled if a USB device is connected. Now you should select the CSV format and enter a filename (e.g. "samples.csv"). After that you can save the file.</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<h3 style="clear: both; text-align: left;">
2. convert data</h3>
<div>
<br /></div>
<div>
The CSV file can be converted with a simple command:</div>
<div>
<br /></div>
<code class="bash functions" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(255, 20, 147) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; line-height: 20px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: nowrap; width: auto !important;">cat</code><span style="background-color: white; color: #004c84; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; line-height: 20px; white-space: nowrap;"> </span><code class="bash plain" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; line-height: 20px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: nowrap; width: auto !important;">samples.csv | </code><code class="bash functions" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(255, 20, 147) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; line-height: 20px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: nowrap; width: auto !important;">cut</code><span style="background-color: white; color: #004c84; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; line-height: 20px; white-space: nowrap;"> </span><code class="bash plain" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; line-height: 20px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: nowrap; width: auto !important;">-d , -f 2,3 -s | nawk </code><code class="bash string" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 51, 102) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; line-height: 20px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: nowrap; width: auto !important;">'{print $0"@"FNR}' </code><code class="bash plain" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; line-height: 20px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: nowrap; width: auto !important;">|</code><code class="bash plain" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; line-height: 20px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: nowrap; width: auto !important;"> </code><br />
<code class="bash functions" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(255, 20, 147) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; line-height: 20px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: nowrap; width: auto !important;">tr</code><span style="background-color: white; color: #004c84; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; line-height: 20px; white-space: nowrap;"> </span><code class="bash plain" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; line-height: 20px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: nowrap; width: auto !important;">-d </code><code class="bash string" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 51, 102) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; line-height: 20px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: nowrap; width: auto !important;">'\r'</code><span style="background-color: white; color: #004c84; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; line-height: 20px; white-space: nowrap;"> </span><code class="bash plain" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; line-height: 20px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: nowrap; width: auto !important;">| </code><code class="bash functions" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(255, 20, 147) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; line-height: 20px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: nowrap; width: auto !important;">tr</code><span style="background-color: white; color: #004c84; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; line-height: 20px; white-space: nowrap;"> </span><code class="bash plain" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; line-height: 20px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: nowrap; width: auto !important;">-d </code><code class="bash string" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 51, 102) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; line-height: 20px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: nowrap; width: auto !important;">','</code><span style="background-color: white; color: #004c84; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; line-height: 20px; white-space: nowrap;"> </span><code class="bash plain" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; line-height: 20px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: nowrap; width: auto !important;">| </code><code class="bash functions" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(255, 20, 147) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; line-height: 20px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: nowrap; width: auto !important;">sed</code><span style="background-color: white; color: #004c84; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; line-height: 20px; white-space: nowrap;"> </span><code class="bash plain" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; line-height: 20px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: nowrap; width: auto !important;">-e </code><code class="bash string" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 51, 102) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; line-height: 20px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: nowrap; width: auto !important;">"s/ 0 /00/"</code><span style="background-color: white; color: #004c84; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; line-height: 20px; white-space: nowrap;"> </span><code class="bash plain" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; line-height: 20px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: nowrap; width: auto !important;">> samples.ols</code><br />
<br />
<div>
<code class="bash plain" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 14px; height: auto !important; left: auto !important; line-height: 20px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: nowrap; width: auto !important;"><br /></code></div>
<div>
This command creates a new file "samples.ols", which has to be converted. For this, you should open the file and remove the first two lines. Afterwards, you should add the parameter <i>Rate</i> and <i>Channels </i>as first two lines. <i>Rate</i> is the bandwidth of the oscilloscope (here 50MHz) and <i>Channels</i> defines the count of used channels (1-16). The file should now look like this:</div>
<div>
<br /></div>
<div>
<div class="line number1 index0 alt2" style="background: none rgb(255, 255, 255) !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #004c84; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; height: auto !important; left: auto !important; line-height: 20px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: nowrap !important; width: auto !important;">
<code class="java plain" style="background: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 0, 0) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">;Rate: </code><code class="java value" style="background: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 153, 0) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">50000000</code></div>
<div class="line number2 index1 alt1" style="background: none rgb(255, 255, 255) !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #004c84; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; height: auto !important; left: auto !important; line-height: 20px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: nowrap !important; width: auto !important;">
<code class="java plain" style="background: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 0, 0) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">;Channels: </code><code class="java value" style="background: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 153, 0) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">2</code></div>
<div class="line number3 index2 alt2" style="background: none rgb(255, 255, 255) !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #004c84; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; height: auto !important; left: auto !important; line-height: 20px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: nowrap !important; width: auto !important;">
<code class="java value" style="background: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 153, 0) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">0000</code><code class="java color1" style="background: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(128, 128, 128) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">@1</code></div>
<div class="line number4 index3 alt1" style="background: none rgb(255, 255, 255) !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #004c84; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; height: auto !important; left: auto !important; line-height: 20px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: nowrap !important; width: auto !important;">
<code class="java value" style="background: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 153, 0) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">0000</code><code class="java color1" style="background: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(128, 128, 128) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">@2</code></div>
<div class="line number5 index4 alt2" style="background: none rgb(255, 255, 255) !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #004c84; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; height: auto !important; left: auto !important; line-height: 20px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: nowrap !important; width: auto !important;">
<code class="java value" style="background: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 153, 0) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">000</code><code class="java color1" style="background: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(128, 128, 128) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">@3</code></div>
<div class="line number6 index5 alt1" style="background: none rgb(255, 255, 255) !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #004c84; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; height: auto !important; left: auto !important; line-height: 20px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: nowrap !important; width: auto !important;">
<code class="java value" style="background: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 153, 0) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">000</code><code class="java color1" style="background: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(128, 128, 128) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">@4</code></div>
<div class="line number7 index6 alt2" style="background: none rgb(255, 255, 255) !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #004c84; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; height: auto !important; left: auto !important; line-height: 20px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: nowrap !important; width: auto !important;">
<code class="java value" style="background: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 153, 0) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">003</code><code class="java color1" style="background: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(128, 128, 128) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">@5</code></div>
<div class="line number8 index7 alt1" style="background: none rgb(255, 255, 255) !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #004c84; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; height: auto !important; left: auto !important; line-height: 20px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: nowrap !important; width: auto !important;">
<br /></div>
</div>
<h3 style="clear: both; text-align: left;">
3. Import data in OLS</h3>
<div>
Now the file "samples.ols" can be imported in Open Logic Sniffer. Open the file with the menu entry "File -> Open". If everything was correct you should see you data: </div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhO_lOvBChAMZUVq2k-a64Z-JU1Nak6rf9lyT53EXGuz3RdiCxvm6QPF-J9D3q8IPjx-yQ654f8xuM4oDSaWuWj5zKjFIFCb6IblN_2QH5lkZZGjS9bazcWt_uaJDT7XJWN32kL4wA5uUU/s1600/20140729_OLS.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhO_lOvBChAMZUVq2k-a64Z-JU1Nak6rf9lyT53EXGuz3RdiCxvm6QPF-J9D3q8IPjx-yQ654f8xuM4oDSaWuWj5zKjFIFCb6IblN_2QH5lkZZGjS9bazcWt_uaJDT7XJWN32kL4wA5uUU/s1600/20140729_OLS.png" height="360" width="640" /></a></div>
<br />Anonymoushttp://www.blogger.com/profile/15726432233249362681noreply@blogger.com0tag:blogger.com,1999:blog-2183049485401572427.post-15264046897164451712014-07-27T06:12:00.000-07:002015-01-14T12:05:39.962-08:00STM32F4 controlled omnidirectional mecanum robot with odometryThis blog has been moved: <a href="http://scholtyssek.org/blog/2014/07/27/stm32f4-controlled-omnidirectional-mecanum-robot-with-odometry/">http://scholtyssek.org/blog/2014/07/27/stm32f4-controlled-omnidirectional-mecanum-robot-with-odometry/</a><br />
<br />
In the last months I worked on a new project based on an ARM STM32F4 controller. The goal was to implement a software to control a robot with mecanum wheels (also called swedish wheels). These wheels are very special, because there are rubber rollers arranged at 45 degree on the outer rim that roll passively on the ground. Thus the robot has a further degree of freedom. This means all directions (X, Y, Θ) can be reached by the robot on a plane. Despite the lack of steering axle it has the maximum freedom of movement. X and Y corresponds to the movement in the respective directions, and Θ represents the rotational movement of the robot.<br />
<br />
<h2>
the robot </h2>
In the robot is a <a href="http://www.nexusrobot.com/product.php?id_product=67" style="text-align: justify;">Nexus 4WD</a>. It has four Faulhaber motors which are directly equipped with incremental encoders furthermore it also has (ultrasonic) distance sensors and an Arduino controller with suitable motor drivers. The 12 V DC motors are powered by a battery that is connected with a standard Tamiya plug.<br />
Since I have decided to use the STM32F4, I performed some modifications on the robot. In particular, the Arduino controller was replaced by the STM32F4, but this had the consequence that the motor drivers that were permanently installed on the board of Arduino, were also removed from the robot. Therefore, a new engine controller with appropriate drivers (h-bridge) had to be developed so that the motors can be controlled properly. In addition to the existing sensors and actuators, the robot is equipped with a gyroscope so that the orientation, that is, the rotation movements of the robot, can be measured in the context of odometry.<br />
<br />
<i>Figure1</i> and <i>figure2</i> are showing the robot with a open chassis. They also show the four Mecanum wheels which are fixed to the shafts of the motors. In addition, you can see - despite the bunch of wires - the hardware components and the battery. <i>Figure2</i> shows the robot in a top view and <i>figure3</i> shows the individually hardware highlighted.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjl1i_7pmUX4g775caJpQF9vtWA4gtf8y98LWs4gz-Lf_HCg6LHOVPpkchRrUaVXXJBPun45HoL8fxJpP1aitrRlobYNzAwXZiCVjD_xw0CxR1BWSpDNxNt66KN2Ajs59-Cn5uB29quvI8/s1600/20140625_141645.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto; text-align: center;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjl1i_7pmUX4g775caJpQF9vtWA4gtf8y98LWs4gz-Lf_HCg6LHOVPpkchRrUaVXXJBPun45HoL8fxJpP1aitrRlobYNzAwXZiCVjD_xw0CxR1BWSpDNxNt66KN2Ajs59-Cn5uB29quvI8/s1600/20140625_141645.jpg" height="360" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Figure1: Nexus 4WD (back view)</td></tr>
</tbody></table>
<br />
<a name='more'></a><br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMoAsQQKcr8NNiG7S_NMIdp1P-fJVxTOZdV-aPQBN_ZzINrlk52nmS1g85EmxXYcXWB6C1Ki7M8hazAsKFRdOqNR226SmmfdVqNK87v7ygTa9GX04YR5rs3M0lcNZiIkZIpj4JOdJgCQg/s1600/Nexus.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto; text-align: center;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMoAsQQKcr8NNiG7S_NMIdp1P-fJVxTOZdV-aPQBN_ZzINrlk52nmS1g85EmxXYcXWB6C1Ki7M8hazAsKFRdOqNR226SmmfdVqNK87v7ygTa9GX04YR5rs3M0lcNZiIkZIpj4JOdJgCQg/s1600/Nexus.jpg" height="464" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Figure2: Nexus 4WD (top view)</td></tr>
</tbody></table>
<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9EZvD2XlxVZg_0XSdsPmtbIG2GcJflfh7WzAt8GsM87W0vAJelHa0kJK_hyphenhyphenSlTYeSF3_qf2L2wcTXue-OzzVLK3xrtxMApCCNhZHwSRS5fE0AJ36o-sfAZW6EiY1dNTkR3fRT7tRvhlo/s1600/Nexus_bw.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto; text-align: center;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9EZvD2XlxVZg_0XSdsPmtbIG2GcJflfh7WzAt8GsM87W0vAJelHa0kJK_hyphenhyphenSlTYeSF3_qf2L2wcTXue-OzzVLK3xrtxMApCCNhZHwSRS5fE0AJ36o-sfAZW6EiY1dNTkR3fRT7tRvhlo/s1600/Nexus_bw.jpg" height="464" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Figure3: Nexus 4WD with highlighted hardware</td></tr>
</tbody></table>
<div style="text-align: center;">
<br /></div>
The movement of the robot is omnidirectional and it depends on how the wheels are arranged and how they rotate. The mecanum wheels are so arranged that the rollers are arranged into the center of the vehicle (in perspective from above). Thus, the movement direction is defined by wheel movement. <i>Figure4</i> shows three scenarios to illustrate how the directions of rotation of the wheels affect the movement of the robot. So you can see in example (a) that all the wheels rotate forward. The resulting movement of the robot is thus a forward movement. In example (b), the wheels turn in different directions. These on the left side of the robot rotate inwards while the wheels on the right side rotate outwards. The resulting movement is in the Y direction on a plane. In the third example the wheels on the left side rotate backwards while the wheels on the right side rotate forwards. This results in a counterclockwise rotation of the robot.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMd7ALoKoeCh8HJQayGx5lYNXT23icJTWLxukqeVh2QBL75CWknOqG3AxYewxiALjDyyTXwkkfZ0rEsVHUdIPZrabHRE2phFKsrf9RrILGmuwoMWBVdyAo9LQSjmQOFe6OlSW7f28ex0ET/s1600/bewegung_en.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMd7ALoKoeCh8HJQayGx5lYNXT23icJTWLxukqeVh2QBL75CWknOqG3AxYewxiALjDyyTXwkkfZ0rEsVHUdIPZrabHRE2phFKsrf9RrILGmuwoMWBVdyAo9LQSjmQOFe6OlSW7f28ex0ET/s1600/bewegung_en.png" height="210" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="font-size: 13px;">Figure 4: robot motion depending on the rotational direction of the mecanum wheels</span></div>
<br />
<h2>
motor control </h2>
<div>
With the Arduino, the motor driver were also removed because they were mounted on the controller. Therefore, a board has been developed with two Toshiba TB6612FNG motor driver. These driver can handle two motors, so that two pieces were used in total. The drivers are a little undersized, because the engines are given with a maximum current of 1.4A. Since the motor driver only withstand a maximum current of 1.2 A, the engine performance is limited to a maximum of 80% in the software. To control the driver (through the STM32F4) a PWM signal is generated by a timer. This signal causes the driver to create a corresponding voltage to the motors. So the timer generated PWM signal influences the power of the motors.<br />
<br />
<h2 style="text-align: justify;">
incremental encoder</h2>
<div>
<br /></div>
<div>
<a href="http://en.wikipedia.org/wiki/Rotary_encoder#Incremental_rotary_encoder">Incremental encoder</a> are sensors for measuring rotations. With the use of a timer, is possible to measure the angle velocity of an rotation. The angle can be calculated by integration over the time. Because of the fix radius of the wheels, the driven distance can be determined by multiplication of the angle and the radius.<br />
The Nexus robot has four photoelectric incremental encoder, which generate 12 pulses per rotation. Photoelectrical encoder emit a light pulse through a rotating disc, which has a couple of slits. Thus, a periodic Signal is generated, which allows to conclude the velocity and the direction of a wheel. This signal is getting interpreted by the STM32F4 controller and processed by the software. The rotations of the motors are transmitted by a gear with a ratio of 64:1. So the count of the pulses are increased to 768 pulses per rotation. The STM32F4 controller has quadrature encoders, so the steps per rotation are again increased by the factor four to 3072 in total. Thus, the resolution of the incremental encoder is approximately 0.117°.<br />
<br />
The following example shows the initialization of an encoder as a quadrature encoder:<br />
<br />
<pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> void initEncoders(fahrzeug_t *fz) {
fz->encoder[0].id = ENCODER_1;
fz->encoder[0].direction = FORWARD;
GPIO_InitTypeDef GPIO_InitStructure;
// Takt fuer die Ports einschalten
RCC_AHB1PeriphClockCmd(ENC1A_GPIO_CLK, ENABLE);
RCC_AHB1PeriphClockCmd(ENC1B_GPIO_CLK, ENABLE);
GPIO_StructInit(&GPIO_InitStructure);
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
/************************* MOTOR1 *************************************/
GPIO_InitStructure.GPIO_Pin = ENC1A_PIN;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_Init(ENC1A_GPIO_PORT, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = ENC1B_PIN;
GPIO_Init(ENC1B_GPIO_PORT, &GPIO_InitStructure);
GPIO_PinAFConfig(ENC1A_GPIO_PORT, ENC1A_SOURCE, ENC1A_AF);
GPIO_PinAFConfig(ENC1B_GPIO_PORT, ENC1B_SOURCE, ENC1B_AF);
RCC_APB1PeriphClockCmd(ENC1_TIMER_CLK, ENABLE);
// Vierfachauswertung
TIM_EncoderInterfaceConfig(ENC1_TIMER, TIM_EncoderMode_TI12,
TIM_ICPolarity_Rising, TIM_ICPolarity_Rising);
TIM_SetAutoreload(ENC1_TIMER, 0xffff);
TIM_Cmd(ENC1_TIMER, ENABLE);
}
</code></pre>
<br />
Afterwards, the counted pulses can be read by the timer register:<br />
<br />
<pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> int32_t getEncoderValue(encoder_t *enc) {
switch (enc->id) {
case ENCODER_1:
enc->currentValue = TIM_GetCounter(ENC1_TIMER);
TIM_SetCounter(ENC1_TIMER, 0);
break;
case ENCODER_2:
enc->currentValue = TIM_GetCounter(ENC2_TIMER);
TIM_SetCounter(ENC2_TIMER, 0);
break;
case ENCODER_3:
enc->currentValue = TIM_GetCounter(ENC3_TIMER);
TIM_SetCounter(ENC3_TIMER, 0);
break;
case ENCODER_4:
enc->currentValue = TIM_GetCounter(ENC4_TIMER);
TIM_SetCounter(ENC4_TIMER, 0);
break;
}
return enc->currentValue;
}
</code></pre>
<div>
<code style="word-wrap: normal;"><br />
</code></div>
<h2>
gyroscope</h2>
<div>
The gyroscope is used to measure the relative angular change of an rotation. The robot was equipped with an GyroClick module for MikroEletronika, which has an L3GD20 rate sensor (see <i>figure5</i>). The robot can only move on the ground, so it is sufficient to measure the yaw rate. So the rotations along the Z-axis will be used to calculate the orientation of the robot. The gyroscope measures the angle velocities, the relative angle can be calculated by integration over the time. For the communication with the STM32F4 controller, a SPI bus is used. The gyroscope works with a sample rate of 760Hz.<br />
<br /></div>
<div>
<div>
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOZxL2Pp7IhosXR0D_zRD7z82qfNGaFql6Vc4hympodrxMSEjNxtoZRBv3tQm_m5eqZb8GO6gIaVD7JpNS14Cy4ypvNaYFdoD1a2F8T3hyn9_4FXWdWl3QgPxOj8g-XVvb1ayUNV-rXck/s1600/gyro.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOZxL2Pp7IhosXR0D_zRD7z82qfNGaFql6Vc4hympodrxMSEjNxtoZRBv3tQm_m5eqZb8GO6gIaVD7JpNS14Cy4ypvNaYFdoD1a2F8T3hyn9_4FXWdWl3QgPxOj8g-XVvb1ayUNV-rXck/s1600/gyro.png" height="200" width="170" /></a></td></tr>
<tr><td class="tr-caption" style="font-size: 13px;">Figure5: GyroClick rate sensor</td></tr>
</tbody></table>
<div>
The gyroscope drifts very much, so it was necessary to calibrate it. Therefore were two calibration steps accomplished during the initialization phase. First, the bias was measured by a couple of reference measurements in zero position. The bias was calculated by the average over the measurements. <i>Figure6</i> shows an uncalibrated measurement in zero position. It is apparent that the measured value is shifted by an offset of -56. This corresponds to approximate -0.49°/s by and resolution of 8.75°/s.</div>
<div>
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSg_q9g6yIaObV5k2Zfz-dkYuuP56paYlHyN8eCk1aKJVH8m1X7WSsra9-7TnVkYNK-AGGUrIsXYXUTnTF0MUW7ohoSi4B3HZH0BCU9ErVUW5tRVKNpUEw3k7ne2OFt5Qtawk65nEPry4/s1600/GyroOffset.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSg_q9g6yIaObV5k2Zfz-dkYuuP56paYlHyN8eCk1aKJVH8m1X7WSsra9-7TnVkYNK-AGGUrIsXYXUTnTF0MUW7ohoSi4B3HZH0BCU9ErVUW5tRVKNpUEw3k7ne2OFt5Qtawk65nEPry4/s1600/GyroOffset.png" height="394" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="font-size: 13px;">Figure6: Measurement in zero position for calculating the bias</td></tr>
</tbody></table>
<div>
The second step is used to prevent against influence by noise. In the software a threshold defines the minimum angular velocity to detect an angle change. So it is not possible to measure very small angle changes, but the drift is reduced really good, so that this could be approved. To get the relative angle of an rotation, the angular velocity has to be integrated over the time. In the software the integration is implemented with the trapezoidal rule. The following example shows the offset calculation with the average over 2000 measurements:<br />
</div>
<div>
<br />
<pre style="background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; width: 646.46875px;"><code style="word-wrap: normal;"> void calcGyroOffsetSpi(void) {
int32_t data = 0;
for (int i = 0; i < 2000; i++) {
data += readGyroscopeZAxis();
}
spiGyroOffset = (data / 2000);
}
</code></pre>
<br /></div>
<div>
The next code snipped shows the calculation of the threshold for the noise:<br />
<br /></div>
<pre style="background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; width: 646.46875px;"><code style="word-wrap: normal;"> void calcGyroNoiseSpi(void){
int32_t ZG = 0;
for(int i=0;i&lt;2000;i++){
ZG = readGyroscopeZAxis();
if(ZG-spiGyroOffset &gt; spiGyroNoise){
spiGyroNoise = (int) ZG-spiGyroOffset;
}else if((int)ZG-spiGyroOffset < -spiGyroNoise){
spiGyroNoise = -((int) ZG-spiGyroOffset);
}
}
spiGyroNoise = spiGyroNoise / 114;
}
</code></pre>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
With there values, is is possible to get the relative angle by integration with the <span style="text-align: start;">trapezoidal rule. The result is mapped to the interval [0</span><span style="text-align: start;">°</span><span style="text-align: start;">,360</span><span style="text-align: start;">°</span><span style="text-align: start;">]:</span></div>
<div style="text-align: justify;">
<br /></div>
<pre style="background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; width: 646.46875px;"><code style="word-wrap: normal;"> gyro_t* calcSpiGyroDelta(uint32_t delta) {
lastValue = value;
int16_t val = readGyroscopeZAxis();
gyroData-&gt;angleDelta = 0.0;
value = ((double) (val - spiGyroOffset) / 114); // 1 / (8.75 * 10^-3) [1/mdps] = 114.29 [s/d]
if(value >= spiGyroNoise || value <= -spiGyroNoise){
gyroData->angleDelta = ((double) ((value + lastValue)) * delta / (2000000));
gyroData->angle += gyroData->angleDelta;
}
if (angle < 0) {
gyroData->angle += 360;
} else if (angle >= 360) {
gyroData->angle -= 360;
}
return gyroData;
} </code></pre>
<h2 style="text-align: justify;">
odometry</h2>
<h2 style="text-align: justify;">
<span style="font-size: x-small; font-weight: normal; text-align: start;"><a href="http://de.wikipedia.org/wiki/Odometrie" target="_blank">Odometry</a> is a method to calculate the position of ground based robots by considering the rotation of the wheels (or the steps of humanoid robots). Many robots are able to measure the wheel rotation anyway, so it very popular to use these information for localization of the robot. </span><span style="font-size: small;"><span style="font-weight: normal;">The covered distance </span></span><span style="font-size: x-small; font-weight: normal; text-align: start;">of an rotation can be calculated with the covered angle and the radius of the wheel. So the complete way of the robot can be traced. </span><span style="font-size: x-small; font-weight: normal; text-align: start;">The sampling rate is 5ms, so there is much (odometry-) data will be produced. This data is stored to an microSD card with the use of an DMA-Controller and</span><span style="font-size: x-small; font-weight: normal; text-align: start;"> </span><a href="http://elm-chan.org/fsw/ff/00index_e.html" style="font-size: medium; font-weight: normal; text-align: start;" target="_blank">FatFs</a><span style="font-size: x-small; font-weight: normal; text-align: start;"> library</span><span style="font-size: x-small; font-weight: normal; text-align: start;"> </span><span style="font-size: x-small; font-weight: normal; text-align: start;">by SPI. The odometry data is available for later evaluation. <i>Figure7</i> shows the traced data of an test drive. This route had a distance of </span><span style="font-size: x-small; font-weight: normal; text-align: start;">6280mm and the robot was localized </span><span style="font-size: small;"><span style="font-weight: normal;">with every 5</span></span><span style="font-size: x-small; font-weight: normal; text-align: start;">ms. The robot has an offset while straight ahead driving. This is, because there is no speed regulation </span><span style="font-size: x-small; font-weight: normal; text-align: start;">for the motors</span><span style="font-size: x-small; font-weight: normal; text-align: start;"> implemented at the moment. </span></h2>
<h2 style="text-align: justify;">
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhuY6t2UXM33rMSk011aaxQePl42xycY8mYCaiFA6CpsFgxJhbsLoTHcSCUH5GssurFOFwGbecbvRQs0uNtqXf-y_4KA6vqgfnoZFscQ5Aw0792ZTHnCxzSO97jL_S9zYx60CYaxHY6cJU/s1600/Messung2.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhuY6t2UXM33rMSk011aaxQePl42xycY8mYCaiFA6CpsFgxJhbsLoTHcSCUH5GssurFOFwGbecbvRQs0uNtqXf-y_4KA6vqgfnoZFscQ5Aw0792ZTHnCxzSO97jL_S9zYx60CYaxHY6cJU/s1600/Messung2.png" height="258" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="font-size: 13px;">Figure7: Traced odometry data</td></tr>
</tbody></table>
<br />
<span style="font-size: x-small; font-weight: normal; text-align: start;"></span></h2>
</div>
</div>
</div>
<div style="text-align: center;">
<br /></div>
<div style="text-align: center;">
<iframe allowfullscreen="" frameborder="0" height="315" src="//www.youtube.com/embed/Z2H76EGxPEw?rel=0" width="420"></iframe><br />
<div style="text-align: center;">
<br />
<iframe allowfullscreen="" frameborder="0" height="315" src="//www.youtube.com/embed/oXgKqsKC900?rel=0" width="420"></iframe><br /></div>
</div>
Anonymoushttp://www.blogger.com/profile/15726432233249362681noreply@blogger.com0tag:blogger.com,1999:blog-2183049485401572427.post-52997176461864025352013-10-21T06:07:00.000-07:002015-01-14T12:07:07.401-08:00Yakindu Statechart Tools Arduino Integration<div style="margin-bottom: 0cm;">
<div style="text-align: justify;">
This blog has been moved: <a href="http://scholtyssek.org/blog/2013/10/21/yakindu-statechart-tools-arduino-integration/">http://scholtyssek.org/blog/2013/10/21/yakindu-statechart-tools-arduino-integration/</a><br />
<br />
The <a href="http://statecharts.org/">Yakindu Statechart Tools</a> are predestined to describe behaviour for a system and afterwards generate code. The output code could be Java, C or C++. We would like to use the code generator in the context of embedded systems and so we decided to generate code for an Arduino Uno. Therefor we modified our statechart TrafficLight example and implemented some simple glue code to map the hardware timer and the I/O-ports. Furthermore it was necessary to built a hardware controller that represents the traffic light and so we created a simple controller (it's available as eagle plan in the appendix and could easily be reconstructed). The example is directly implemented for the AVR ATMEGA328P-PU processor (this one is on the Arduino Uno). It is possible to use the Arduino library to integrate this system, but we would like to support the whole AVR family and so it was the better way to use the AVR library directly. With this solution the Yakindu SCT could be used on many AVR based processors.</div>
</div>
<div style="margin-bottom: 0cm;">
<div style="text-align: justify;">
<br />
<a name='more'></a><br /></div>
</div>
<div style="margin-bottom: 0cm;">
<div style="text-align: justify;">
To explore the example project, you have to go through some steps:</div>
<h2 style="text-align: justify;">
1. Environment</h2>
</div>
<ul>
<li><div style="margin-bottom: 0cm;">
<div style="text-align: justify;">
<span lang="en-GB">D</span><span lang="en-GB">ownload the eclipse IDE </span><span lang="en-GB">with Yakindu SCT from our download section, or install the Yakindu SCT by using the Eclipse update manager (see: </span>http://statecharts.org/download.html<span lang="en-GB">)</span><span lang="en-GB">.</span></div>
</div>
</li>
</ul>
<ul>
<li><div style="margin-bottom: 0cm;">
<div style="text-align: justify;">
<span lang="en-GB">Install the AVR plugin for eclipse </span><span lang="en-GB">fro</span><span lang="en-GB">m</span><span lang="en-GB"> </span></div>
<div style="text-align: justify;">
<span style="background-color: white;"><span lang="en-GB"></span><a href="http://avr-eclipse.sourceforge.net/wiki/index.php/The_AVR_Eclipse_Plugin"><span lang="en-GB"><i>http://avr-eclipse.sourceforge.net/wiki/index.php/The_AVR_Eclipse_Plugin</i></span></a></span></div>
</div>
</li>
</ul>
<ol><div style="margin-bottom: 0cm;">
</div>
</ol>
<ul>
<li><div style="margin-bottom: 0cm;">
<div style="text-align: justify;">
On Linux, install the AVR environment:</div>
<div style="text-align: justify;">
<i style="background-color: white;">sudo apt-get install avrdude binutils-avr gcc-avr avr-libc gdb-avr.</i></div>
</div>
</li>
</ul>
<ul><div style="margin-bottom: 0cm;">
</div>
<li><div style="margin-bottom: 0cm;">
<div style="text-align: justify;">
<span lang="en-GB"><span style="font-style: normal;">Get the Arduino software from</span></span><span lang="en-GB"><i> </i></span><i>http://arduino.cc/en/Main/Software</i><span lang="en-GB"><i> </i></span><span lang="en-GB"><span style="font-style: normal;">and build the necessary </span></span><span lang="en-GB"><i>libArduinoCore.a. </i></span><span lang="en-GB"><i>S</i></span><span lang="en-GB"><span style="font-style: normal;">ee</span></span><span lang="en-GB"><i><a href="http://playground.arduino.cc/Code/Eclipse#Arduino_core_library"> http://playground.arduino.cc/Code/Eclipse#Arduino_core_library</a></i></span><span lang="en-GB"><span style="font-style: normal;"> for detailed description. Now set the include path to the Arduino specific header files </span></span>and<i> </i>also to the <i>libArduinoCore.a.</i><i> </i>The <i>libArduinoCore.a</i> should be stored in a folder called "lib" in the project directory. The include path should look like this:<br />
<br />
<span lang="en-GB"><i><install_dir>/arduino-1.0.5/hardware/arduino/variants/mega</i></span><br />
<i><install_dir>/arduino-1.0.5/hardware/arduino/cores/arduino</i></div>
</div>
</li>
</ul>
<ul>
<li><div style="margin-bottom: 0cm;">
<div style="text-align: justify;">
<span lang="en-GB"><span style="font-style: normal;">Open Eclipse </span></span><span lang="en-GB"><span style="font-style: normal;">and</span></span><span lang="en-GB"><span style="font-style: normal;"> install the SVN Plugin </span></span><span lang="en-GB"><span style="font-style: normal;">including the</span></span><span lang="en-GB"><span style="font-style: normal;"> </span></span><span lang="en-GB"><span style="font-style: normal;">SVN </span></span><span lang="en-GB"><span style="font-style: normal;">Kit</span></span><span lang="en-GB"><span style="font-style: normal;"> via eclipse marketplace. </span></span><span lang="en-GB"><span style="font-style: normal;">Afterwards</span></span><span lang="en-GB"><span style="font-style: normal;"> </span></span><span lang="en-GB"><span style="font-style: normal;">import</span></span><span lang="en-GB"><span style="font-style: normal;"> the </span></span><span lang="en-GB"><span style="font-style: normal;">Arduino</span></span><span lang="en-GB"><span style="font-style: normal;">TrafficLight example </span></span>project <span lang="en-GB">from </span><span lang="en-GB">our</span><span lang="en-GB"> SVN repository (</span><span lang="en-GB"><a href="http://code.google.com/a/eclipselabs.org/p/yakindu/source/checkout">http://code.google.com/a/eclipselabs.org/p/yakindu/source/checkout</a>). You can find this project in the example folder. After importing the project, you have to check if the include-path is set correct for your system.</span></div>
</div>
</li>
</ul>
<ul>
<li><div style="margin-bottom: 0cm;">
<div style="text-align: justify;">
<span lang="en-GB"><span style="font-style: normal;">Build the TrafficLight hardware controller (see circuit layout in the appendix</span></span><span lang="en-GB">) </span><span lang="en-GB">and connect the ports to the Arduino Uno.</span></div>
</div>
</li>
</ul>
<ul>
<li><div style="margin-bottom: 0cm;">
<div style="text-align: justify;">
As next you have to generate the C++ code by using the TrafficLight.sgen (right click on the file and then generate artifacts). Currently there is an open issue and you have to fix it manually. Open the <i>src-gen/sc_types.h</i> file and <b>change the datatype</b> <b><i>sc_integer</i></b><b style="font-style: normal;"> from </b><b><i>int32_t</i></b><b style="font-style: normal;"> to </b><b><i>uint32_t</i></b>. That's all. Next, compile the code. For this, you can use the icon with the small hammer in eclipse.</div>
</div>
</li>
</ul>
<ul>
<li><div style="font-style: normal; margin-bottom: 0cm;">
<div style="text-align: justify;">
Last but not least you have to flash the compiled program on the processor by activating the AVR-icon.</div>
</div>
</li>
</ul>
<div style="font-style: normal; margin-bottom: 0cm;">
<div style="text-align: justify;">
<br /></div>
</div>
<div style="font-style: normal; margin-bottom: 0cm;">
<div style="text-align: justify;">
Now you are able to use the generated code on the Arduino board. Feel free to modify the statechart model and test the behaviour on the hardware platform.</div>
</div>
<div style="font-style: normal; margin-bottom: 0cm;">
<div style="text-align: justify;">
<br /></div>
</div>
<div style="font-style: normal; margin-bottom: 0cm; page-break-before: always;">
<div style="text-align: justify;">
<b><u>S</u><u>ome explaining words to the example code</u> </b> </div>
</div>
<div style="font-style: normal; margin-bottom: 0cm;">
<div style="text-align: justify;">
<br /></div>
</div>
<div style="font-style: normal; margin-bottom: 0cm;">
<div style="text-align: justify;">
There are three things you have to implement as glue code, so that the Arduino works:</div>
</div>
<div style="font-style: normal; margin-bottom: 0cm;">
<br /></div>
<div style="font-style: normal; margin-bottom: 0cm;">
<h2>
2. CycleRunner</h2>
</div>
<div style="font-style: normal; margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<div style="margin-bottom: 0cm;">
<div style="text-align: justify;">
<span lang="en-GB"><span style="font-style: normal;"><span style="text-decoration: none;">The CycleRunner checks periodically for state changes</span></span></span><span lang="en-GB"><span style="font-style: normal;"><span style="text-decoration: none;">. It uses timer0 </span></span></span><span lang="en-GB"><span style="font-style: normal;"><span style="text-decoration: none;">to trigger a </span></span></span><span lang="en-GB"><span style="font-style: normal;"><span style="text-decoration: none;">completion step </span></span></span><span lang="en-GB"><span style="font-style: normal;"><span style="text-decoration: none;">periodically.</span></span></span><span lang="en-GB"><span style="font-style: normal;"><span style="text-decoration: none;"> An implementation could look like this:</span></span></span></div>
</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<pre class="western"><span style="color: #3f7f5f;"><span style="font-family: Source Code Pro, serif;"><span style="font-size: xx-small;">/**</span></span></span>
<span style="color: #3f7f5f;"> <span style="font-family: Source Code Pro, serif;"><span style="font-size: xx-small;">* The cycleRunner uses timer0 for his cycle-time-calculation (every second)</span></span></span>
<span style="color: #3f7f5f;"> <span style="font-family: Source Code Pro, serif;"><span style="font-size: xx-small;">*/</span></span></span>
<span style="font-size: xx-small;"><span style="color: #7f0055;"><span style="font-family: Source Code Pro, serif;"><b>void</b></span></span><span style="color: black;"><span style="font-family: Source Code Pro, serif;"> </span></span><span style="color: black;"><span style="font-family: Source Code Pro, serif;"><b>CycleRunner::start</b></span></span><span style="color: black;"><span style="font-family: Source Code Pro, serif;">(</span></span><span style="color: #7f0055;"><span style="font-family: Source Code Pro, serif;"><b>void</b></span></span><span style="color: black;"><span style="font-family: Source Code Pro, serif;">){</span></span></span>
<span style="font-size: xx-small;"><span style="color: black;"><span style="font-family: Source Code Pro, serif;"> TCCR0B |= (1<<CS02) | (1<<CS00); </span></span><span style="color: #3f7f5f;"><span style="font-family: Source Code Pro, serif;">// </span></span><span style="color: #3f7f5f;"><span style="font-family: Source Code Pro, serif;"><u>prescaler</u></span></span><span style="color: #3f7f5f;"><span style="font-family: Source Code Pro, serif;"> 1024</span></span></span>
<span style="font-size: xx-small;"><span style="color: black;"><span style="font-family: Source Code Pro, serif;"> TCNT0 = 0; </span></span><span style="color: #3f7f5f;"><span style="font-family: Source Code Pro, serif;">// </span></span><span style="color: #3f7f5f;"><span style="font-family: Source Code Pro, serif;"><u>Startvalue</u></span></span><span style="color: #3f7f5f;"><span style="font-family: Source Code Pro, serif;"> ->1s to overflow</span></span></span>
<span style="color: black;"><span style="font-family: Source Code Pro, serif;"><span style="font-size: xx-small;"> TIMSK0 |= (1<<TOIE0);</span></span></span>
<span style="color: black;"><span style="font-family: Source Code Pro, serif;"><span style="font-size: xx-small;">}</span></span></span>
<span style="font-size: xx-small;"><span style="color: #7f0055;"><span style="font-family: Source Code Pro, serif;"><b>void</b></span></span><span style="color: black;"><span style="font-family: Source Code Pro, serif;"> </span></span><span style="color: black;"><span style="font-family: Source Code Pro, serif;"><b>CycleRunner::runCycle</b></span></span><span style="color: black;"><span style="font-family: Source Code Pro, serif;">(</span></span><span style="color: #7f0055;"><span style="font-family: Source Code Pro, serif;"><b>void</b></span></span><span style="color: black;"><span style="font-family: Source Code Pro, serif;">){</span></span></span>
<span style="font-size: xx-small;"><span style="color: black;"><span style="font-family: Source Code Pro, serif;"> trafficlight_runCycle(</span></span><span style="color: #0000c0;"><span style="font-family: Source Code Pro, serif;">handle</span></span><span style="color: black;"><span style="font-family: Source Code Pro, serif;">);</span></span></span>
<span style="color: black;"><span style="font-family: Source Code Pro, serif;"><span style="font-size: xx-small;">}</span></span></span>
</pre>
<div style="margin-bottom: 0cm;">
<span style="color: #3f7f5f;"><span style="font-family: Source Code Pro, serif;"><span style="font-size: xx-small;">/*</span></span></span></div>
<div align="LEFT" style="margin-bottom: 0cm;">
<span style="color: #3f7f5f;"> <span style="font-size: xx-small;"><span style="font-family: Source Code Pro, serif;">* the cycleRunner is triggered by this timerinterrupt</span></span></span></div>
<div align="LEFT" style="margin-bottom: 0cm;">
<span style="color: #3f7f5f;"> <span style="font-family: Source Code Pro, serif;"><span style="font-size: xx-small;">*/</span></span></span></div>
<div align="LEFT" style="margin-bottom: 0cm;">
<span style="color: black;"><span style="font-family: Source Code Pro, serif;"><span style="font-size: xx-small;">ISR(TIMER0_OVF_vect) {</span></span></span></div>
<div align="LEFT" style="margin-bottom: 0cm;">
<span style="color: black;"><span style="font-family: Source Code Pro, serif;"><span style="font-size: xx-small;"> runCycleFlag = 1;</span></span></span></div>
<div align="LEFT" style="margin-bottom: 0cm;">
<span style="color: black;"><span style="font-family: Source Code Pro, serif;"><span style="font-size: xx-small;">}</span></span></span></div>
<div style="font-style: normal; margin-bottom: 0cm;">
<br /></div>
<div style="font-style: normal; margin-bottom: 0cm;">
<h2>
3. Timer and TimeEvent</h2>
</div>
<div style="font-style: normal; margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<div style="text-align: justify;">
<span lang="en-GB"><span style="font-style: normal;">The Timer class is a representation </span></span><span lang="en-GB"><span style="font-style: normal;">for</span></span><span lang="en-GB"><span style="font-style: normal;"> the hardware timer </span></span><span lang="en-GB"><span style="font-style: normal;">and i</span></span><span lang="en-GB"><span style="font-style: normal;">t is responsible for initializing the </span></span><span lang="en-GB"><span style="font-style: normal;"> </span></span><span lang="en-GB"><span style="font-style: normal;">timer and raising TimeEvents. </span></span><span lang="en-GB"><span style="font-style: normal;">In this example we are using </span></span><span lang="en-GB"><span style="font-style: normal;">t</span></span><span lang="en-GB"><span style="font-style: normal;">imer1 from the Arduino </span></span><span lang="en-GB"><span style="font-style: normal;">to implement the reaction trigger timer</span></span><span lang="en-GB"><span style="font-style: normal;">.</span></span><span lang="en-GB"><span style="font-style: normal;"> A TimeEvent </span></span><span lang="en-GB"><span style="font-style: normal;">is triggered </span></span><span lang="en-GB"><span style="font-style: normal;">when </span></span><span lang="en-GB"><span style="font-style: normal;">e.g.</span></span><span lang="en-GB"><span style="font-style: normal;"> a </span></span><span lang="en-GB"><span style="font-style: normal;">transition time expired. </span></span><span lang="en-GB"><span style="font-style: normal;">There are situations where you have to use several parallel </span></span><span lang="en-GB"><span style="font-style: normal;">running </span></span><span lang="en-GB"><span style="font-style: normal;">timer thus it was required to store the timeEvents in an array (</span></span><span lang="en-GB"><span style="font-style: normal;">see</span></span><span lang="en-GB"><span style="font-style: normal;"> events </span></span><span lang="en-GB"><span style="font-style: normal;">array in Main.cpp</span></span><span lang="en-GB"><span style="font-style: normal;">).</span></span><span lang="en-GB"><span style="font-style: normal;"> The Timer checks periodically every 10ms for expired </span></span><span lang="en-GB"><span style="font-style: normal;">t</span></span><span lang="en-GB"><span style="font-style: normal;">ime </span></span><span lang="en-GB"><span style="font-style: normal;">ev</span></span><span lang="en-GB"><span style="font-style: normal;">ents and raises them </span></span><span lang="en-GB"><span style="font-style: normal;">if it's necessary</span></span><span lang="en-GB"><span style="font-style: normal;">. </span></span><span lang="en-GB"><span style="font-style: normal;"> </span></span> </div>
</div>
<div style="font-style: normal; margin-bottom: 0cm;">
<br /></div>
<pre class="western"><span style="font-size: xx-small;"><span style="color: #3f7f5f;"><span style="font-family: Source Code Pro, serif;"><span lang="en-GB"><span style="font-style: normal;">// </span></span></span></span><span style="color: #3f7f5f;"><span style="font-family: Source Code Pro, serif;"><span lang="en-GB"><span style="font-style: normal;">Timer ISR that triggers checking for expired time events</span></span></span></span></span>
<span style="font-size: xx-small;"><span style="color: black;"><span style="font-family: Source Code Pro, serif;"><span lang="en-GB"><span style="font-style: normal;">ISR(TIMER1_OVF_vect) </span></span></span></span><span style="color: black;"><span style="font-family: Source Code Pro, serif;"><span lang="en-GB"><span style="font-style: normal;">{</span></span></span></span></span>
<span style="font-size: xx-small;"><span style="color: black;"><span style="font-family: Source Code Pro, serif;"> TCNT1 = 64911; </span></span><span style="color: #3f7f5f;"><span style="font-family: Source Code Pro, serif;">// </span></span><span style="color: #3f7f5f;"><span style="font-family: Source Code Pro, serif;"><u>startvalue</u></span></span><span style="color: #3f7f5f;"><span style="font-family: Source Code Pro, serif;"> for 10ms</span></span></span>
<span style="font-size: xx-small;"><span style="color: black;"><span style="font-family: Source Code Pro, serif;"> </span></span><span style="color: #7f0055;"><span style="font-family: Source Code Pro, serif;"><b>if</b></span></span><span style="color: black;"><span style="font-family: Source Code Pro, serif;"> ((counter++) >= timer->getTimerOverflowCount()) {</span></span></span>
<span style="color: black;"><span style="font-family: Source Code Pro, serif;"><span style="font-size: xx-small;"> counter = 0;</span></span></span>
<span style="color: black;"><span style="font-family: Source Code Pro, serif;"><span style="font-size: xx-small;"> timerRaiseEventFlag = 1;</span></span></span>
<span style="color: black;"><span style="font-family: Source Code Pro, serif;"><span style="font-size: xx-small;"> }</span></span></span>
<span style="color: black;"><span style="font-family: Source Code Pro, serif;"><span style="font-size: xx-small;">}</span></span></span>
<span style="font-size: xx-small;"><span style="color: #7f0055;"><span style="font-family: Source Code Pro, serif;"><b>void</b></span></span><span style="color: black;"><span style="font-family: Source Code Pro, serif;"> </span></span><span style="color: black;"><span style="font-family: Source Code Pro, serif;"><b>Timer::raiseTimeEvent</b></span></span><span style="color: black;"><span style="font-family: Source Code Pro, serif;">() {</span></span></span>
<span style="font-size: xx-small;"><span style="color: black;"><span style="font-family: Source Code Pro, serif;"> </span></span><span style="color: #7f0055;"><span style="font-family: Source Code Pro, serif;"><b>for</b></span></span><span style="color: black;"><span style="font-family: Source Code Pro, serif;">(</span></span><span style="color: #7f0055;"><span style="font-family: Source Code Pro, serif;"><b>int</b></span></span><span style="color: black;"><span style="font-family: Source Code Pro, serif;"> i=0;i<</span></span><span style="color: #0000c0;"><span style="font-family: Source Code Pro, serif;"><i>TIMER_COUNT</i></span></span><span style="color: black;"><span style="font-family: Source Code Pro, serif;">;i++){</span></span></span>
<span style="font-size: xx-small;"><span style="color: black;"><span style="font-family: Source Code Pro, serif;"> </span></span><span style="color: #7f0055;"><span style="font-family: Source Code Pro, serif;"><b>if</b></span></span><span style="color: black;"><span style="font-family: Source Code Pro, serif;">(</span></span><span style="color: #0000c0;"><span style="font-family: Source Code Pro, serif;">events</span></span><span style="color: black;"><span style="font-family: Source Code Pro, serif;">[i] == NULL)</span></span></span>
<span style="font-size: xx-small;"><span style="color: black;"><span style="font-family: Source Code Pro, serif;"> </span></span><span style="color: #7f0055;"><span style="font-family: Source Code Pro, serif;"><b>continue</b></span></span><span style="color: black;"><span style="font-family: Source Code Pro, serif;">;</span></span></span>
<span style="font-size: xx-small;"><span style="color: black;"><span style="font-family: Source Code Pro, serif;"> </span></span><span style="color: #7f0055;"><span style="font-family: Source Code Pro, serif;"><b>if</b></span></span><span style="color: black;"><span style="font-family: Source Code Pro, serif;">((</span></span><span style="color: #0000c0;"><span style="font-family: Source Code Pro, serif;">events</span></span><span style="color: black;"><span style="font-family: Source Code Pro, serif;">[i]->getTimeMs()/10) <= </span></span><span style="color: #0000c0;"><span style="font-family: Source Code Pro, serif;">events</span></span><span style="color: black;"><span style="font-family: Source Code Pro, serif;">[i]->getTimerOverflowCount()){</span></span></span>
<span style="font-size: xx-small;"><span style="color: black;"><span style="font-family: Source Code Pro, serif;"> trafficlight_raiseTimeEvent(</span></span><span style="color: #0000c0;"><span style="font-family: Source Code Pro, serif;">sc_handle</span></span><span style="color: black;"><span style="font-family: Source Code Pro, serif;">, </span></span><span style="color: #0000c0;"><span style="font-family: Source Code Pro, serif;">events</span></span><span style="color: black;"><span style="font-family: Source Code Pro, serif;">[i]->getEventId());</span></span></span>
<span style="font-size: xx-small;"><span style="color: black;"><span style="font-family: Source Code Pro, serif;"> </span></span><span style="color: #0000c0;"><span style="font-family: Source Code Pro, serif;">events</span></span><span style="color: black;"><span style="font-family: Source Code Pro, serif;">[i]->setTimerOverflowCount(0);</span></span></span>
<span style="color: black;"><span style="font-family: Source Code Pro, serif;"><span style="font-size: xx-small;"> }</span></span></span>
<span style="font-size: xx-small;"><span style="color: black;"><span style="font-family: Source Code Pro, serif;"> </span></span><span style="color: #0000c0;"><span style="font-family: Source Code Pro, serif;">events</span></span><span style="color: black;"><span style="font-family: Source Code Pro, serif;">[i]->setTimerOverflowCount(</span></span><span style="color: #0000c0;"><span style="font-family: Source Code Pro, serif;">events</span></span><span style="color: black;"><span style="font-family: Source Code Pro, serif;">[i]->getTimerOverflowCount() + 1);</span></span></span>
<span style="color: black;"><span style="font-family: Source Code Pro, serif;"><span style="font-size: xx-small;"> }</span></span></span>
<span style="color: black;"><span style="font-family: Source Code Pro, serif;"><span style="font-size: xx-small;">}</span></span></span>
</pre>
<div style="font-style: normal; margin-bottom: 0cm;">
<br /></div>
<div style="font-style: normal; margin-bottom: 0cm; page-break-before: always;">
<h2>
<span style="font-size: large;">3. IO port mapping</span></h2>
</div>
<div style="font-style: normal; margin-bottom: 0cm;">
<div style="text-align: justify;">
<br /></div>
</div>
<div style="font-style: normal; margin-bottom: 0cm; text-decoration: none;">
<div style="text-align: justify;">
<span style="font-size: small;">At the moment it is necessary to map the IO ports by yourself. You have to define the port direction and define a method to change the signals. For example you can map the red traffic light LED like this:</span></div>
</div>
<div style="font-style: normal; margin-bottom: 0cm; text-decoration: none;">
<br /></div>
<pre class="western"><span style="font-size: xx-small;"><span style="color: #7f0055;"><span style="font-family: Source Code Pro, serif;"><b>const</b></span></span><span style="color: black;"><span style="font-family: Source Code Pro, serif;"> </span></span><span style="color: #005032;"><span style="font-family: Source Code Pro, serif;">uint8_t</span></span><span style="color: black;"><span style="font-family: Source Code Pro, serif;"> ledPinTrafficRed = DDB5; </span></span><span style="color: #3f7f5f;"><span style="font-family: Source Code Pro, serif;">// the number of the red LED pin</span></span></span>
<span style="font-size: xx-small;"><span style="color: black;"><span style="font-family: Source Code Pro, serif;">DDRB |= (1 << </span></span><span style="color: black;"><span style="font-family: Source Code Pro, serif;">ledPinTrafficRed); </span></span></span><span style="font-family: 'Source Code Pro', serif; font-size: xx-small;"> </span><span style="font-family: 'Source Code Pro', serif; font-size: xx-small;"> </span><span style="color: #3f7f5f; font-size: xx-small;"><span style="font-family: Source Code Pro, serif;">// </span></span><span style="color: #3f7f5f; font-size: xx-small;"><span style="font-family: Source Code Pro, serif;">set out direction for this port</span></span></pre>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="font-style: normal; margin-bottom: 0cm; text-decoration: none;">
<span style="font-size: small;"><span style="color: black;"><span style="font-family: Liberation Serif, serif;">Now you are able to </span></span><span style="color: black;"><span style="font-family: Liberation Serif, serif;">change</span></span><span style="color: black;"><span style="font-family: Liberation Serif, serif;"> the LED </span></span><span style="color: black;"><span style="font-family: Liberation Serif, serif;">signal</span></span><span style="color: black;"><span style="font-family: Liberation Serif, serif;"> by </span></span><span style="color: black;"><span style="font-family: Liberation Serif, serif;">using</span></span><span style="color: black;"><span style="font-family: Liberation Serif, serif;"> the </span></span><span style="color: black;"><span style="font-family: Liberation Serif, serif;">getter method from the statemachine </span></span><span style="color: black;"><span style="font-family: Liberation Serif, serif;">interface</span></span><span style="color: black;"><span style="font-family: Liberation Serif, serif;">:</span></span><span style="color: black;"><span style="font-family: Source Code Pro, serif;"> </span></span></span> </div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<span style="color: black;"><span style="font-family: Source Code Pro, serif;"><span style="font-size: xx-small;">setLight(PORTB, ledPinTrafficRed,</span></span></span></div>
<div align="LEFT" style="margin-bottom: 0cm;">
<span style="color: black;"><span style="font-family: Source Code Pro, serif;"><span style="font-size: xx-small;"> trafficlightIfaceTrafficLight_get_red(&handle));</span></span></span></div>
<div style="font-style: normal; margin-bottom: 0cm;">
<br /></div>
<h2>
<span style="font-size: large;">4. Appendix</span></h2>
<table class="gt-baf-table" style="background-color: white; border-spacing: 0px; color: #777777; font-family: arial, sans-serif; font-size: 14px;"><tbody>
<tr><td style="padding: 0px;"><div class="gt-baf-cell gt-baf-word-clickable" style="color: black; cursor: pointer; direction: ltr; height: 18px; margin: 1px 0px; overflow: hidden; padding: 0px; vertical-align: top; white-space: nowrap;">
<br /></div>
</td><td style="padding: 0px; width: 511px;"></td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
<object height="315" width="420"><param name="movie" value="//www.youtube.com/v/VL-0kzB4yWM?hl=de_DE&version=3&rel=0"></param>
<param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param>
<embed src="//www.youtube.com/v/VL-0kzB4yWM?hl=de_DE&version=3&rel=0" type="application/x-shockwave-flash" width="420" height="315" allowscriptaccess="always" allowfullscreen="true"></embed></object></div>
<br />
<div style="margin-bottom: 0cm;">
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_jdNjQiZdQqNZLXuH1nqhhCmYmvQswTgAW7Zxs63mZ3-tSkil0O9xBNr3fY99vTrkED9FkHGyfBK02I3cK6y3xEe_I9yHaBk_vzwbPUHu9diZl69m3ls6onkffAsFDjqILkApBQp0kRhG/s1600/Yakindu_Statechart_Example.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img alt="" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_jdNjQiZdQqNZLXuH1nqhhCmYmvQswTgAW7Zxs63mZ3-tSkil0O9xBNr3fY99vTrkED9FkHGyfBK02I3cK6y3xEe_I9yHaBk_vzwbPUHu9diZl69m3ls6onkffAsFDjqILkApBQp0kRhG/s1600/Yakindu_Statechart_Example.png" height="400" title="Yakindu trafficLight statechart" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Yakindu trafficlight statechart</td></tr>
</tbody></table>
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiW8JV5RR_myG4EBO_ZNwWk8PjYMIX2GmZIjKEUupipAL05g7TlH2eGHXu6pjAHM5hNQ_hvbdFFJW8W6WdG5V1P-3bvBIoWsypd5wS07uiWjDF187HIWfjJSOUJJmpnm2pljD0H0CcL6OFF/s1600/TrafficLightArduinoUno.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiW8JV5RR_myG4EBO_ZNwWk8PjYMIX2GmZIjKEUupipAL05g7TlH2eGHXu6pjAHM5hNQ_hvbdFFJW8W6WdG5V1P-3bvBIoWsypd5wS07uiWjDF187HIWfjJSOUJJmpnm2pljD0H0CcL6OFF/s1600/TrafficLightArduinoUno.png" height="440" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"> Traffic light circuit layout</td></tr>
</tbody></table>
Anonymoushttp://www.blogger.com/profile/15726432233249362681noreply@blogger.com1