Changes for page Arduino and SCCharts
Last modified by Alexander Schulz-Rosengarten on 2023/09/11 16:17
Summary
-
Page properties (1 modified, 0 added, 0 removed)
-
Objects (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -8,8 +8,10 @@ 8 8 9 9 == Overview == 10 10 11 -Arduino is a project and community wich creates open-source software and open-source hardware. The Arduino boards and software are well suited for novices and expierenced programmers alike to create digital devices. In the following we will see how to develop applications for the Arduino boards using SCCharts together with the [[Arduino Eclipse Plugin>>url:http://eclipse.baeyens.it/||shape="rect"]]. Therefore we will first download and setup the development environment and afterwards create and upload a small example project.11 +Arduino is a project and community wich creates open-source software and open-source hardware. The Arduino boards and software are well suited for novices and expierenced programmers alike to create digital devices. In the following we will see how to develop applications for the Arduino boards using SCCharts together with the [[Arduino Eclipse Plugin>>url:http://eclipse.baeyens.it/||shape="rect"]]. 12 12 13 +Several open-source, third-party replacements for the offical Lego firmware have been developed. These support many well known programming languages, such as Java, C/C++, Python, Lua, etc. In the following we will use KIELER SCCharts to program Mindstorms running the Lego Java Operating System ([[leJOS>>url:http://www.lejos.org/||shape="rect"]]). Therefore we will first install leJOS NXJ and flash its firmware. Afterwards we will create a simple SCCharts project in KIELER that we will compile and deploy to the NXT brick.\\ 14 + 13 13 ---- 14 14 15 15 == Download and Configure KIELER ... ... @@ -19,28 +19,35 @@ 19 19 20 20 **Note:** Java 1.8 is needed on all operating systems. With Java 1.7 not all plugins of KIELER will be loaded. **Furthermore on Windows**, you will need to download the **32 Bit version of KIELER** – even if you have a 64 bit operating system! Otherwise flashing the brick and uploading to the brick will fail. 21 21 22 -=== The ArduinoEclipsePlugin ===24 +=== The Eclipse plugin for leJOS === 23 23 24 -There is an Eclipse plugin for Arduino,whichmakesit easyto createanddeploy projectsandtouse theIDEfeatures ofthe C/C++ DevelopmentTools(CDT) whenprogramming Arduino.26 +There is an Eclipse plugin for leJOS which adds a project creation wizard and launch configuration to the platform. 25 25 26 -You have to install the plugin manually via **Help > Install new Software... **. Use the following update site: [[http:~~/~~/eclipse.baeyens.it/nightly>>url:http://eclipse.baeyens.it/nightly||shape="rect"]] 28 +1. You have to install it via the Eclipse Marketplace (//Help > Eclipse Marketplace...//). 29 +OR 30 +1. Install the plugin manually (Help > Install new Software...). Use the following update site\\ 31 +11. for NXT: [[http:~~/~~/www.lejos.org/tools/eclipse/plugin/nxj/>>url:http://www.lejos.org/tools/eclipse/plugin/nxj/||shape="rect"]] 32 +11. for EV3: [[http:~~/~~/www.lejos.org/tools/eclipse/plugin/ev3/>>url:http://www.lejos.org/tools/eclipse/plugin/ev3/||shape="rect"]] 27 27 28 - Theinstallationmight take afew minutesbecauseit will install theArduino Tools as wellasrequiredsoftwaresuchas theCDT.Furthermoreitwill download the newestversion oftheArduino softwareandlibraries.34 +If you have an **NXT** **brick**, install the **leJOS NXJ** Plug-in. If you have an **EV3 brick**, install the **leJOS EV3** plugin. 29 29 36 +[[image:attach:lejos_eclipse_plugin.png]] 37 + 38 +After the installation, the plugin requires a **little configuration**. Go to //Window > Preferences > leJOS NXJ// (//Window > Preferences > leJOS EV3 //respectively) and enter the base directory of your **leJOS** **installation** in the **NXJ_HOME field**. 39 + 40 +For EV3, the plugin requires the IP address to connect to the brick (it may work without, but its safer to directly set the name. Reduces headache ). Check **Connect to named brick** and enter the **IP adress** of the brick (displayed on the brick at startup). 41 + 30 30 ---- 31 31 32 32 == Creating an Example Project == 33 33 34 -The following shows how to create a project, which will turn anLEDonandoffrepeatedly.46 +The following shows how to create a project, which will turn on a light if a button is pressed. 35 35 36 36 === Create a new project: === 37 37 38 38 1. Choose //File > New > Project > KIELER SCCharts > SCCharts Project// 39 -1. In the project creation wizard that opens, select //Arduino// as environment and hit //finish// 40 -1. The project wizard from the Arduino Eclipse Plugin opens. Set the project name to //Blinky// and click //next//. 41 -1. Set the configuration for your Arduino board. In the field //Upload Protocol// select //Default//. 42 -These settings can be changed later in the project preferences (Right click on project > Preferences > Arduino) 43 -1. Click //finish//. 51 +1. In the project creation wizard that opens, select //Mindstorms NXJ// or// Mindstorms EV3// (depending on your brick) as environment and hit //finish// 52 +1. The project wizard from the leJOS plugin opens. Set the project name to //Flashlight// and click //finish//. 44 44 1. The project is created and the model file is opened in an editor (This might take a few seconds). 45 45 46 46 === Edit the model: === ... ... @@ -48,28 +48,30 @@ 48 48 Change the contents of the model file to the following code and save it. 49 49 50 50 {{code language="sct" theme="Eclipse" title="Floodlight.sct"}} 51 -scchart BlinkyModel {60 +scchart Flashlight { 52 52 53 - @Wrapper Clock,"500"54 - input bool clock;62 + @Wrapper TouchSensor, S4 63 + input bool button; 55 55 56 - @Wrapper DigitalWrite,"13"65 + @Wrapper Floodlight, S1 57 57 output bool light; 58 58 59 59 initial state lightOff 60 - --> lightOn with clock/ light = true;69 + --> lightOn with button / light = true; 61 61 62 62 state lightOn 63 - --> lightOff with clock/ light = false;72 + --> lightOff with !button / light = false; 64 64 } 65 65 {{/code}} 66 66 67 -This model will start in the state lightOff. If the variable //clock//istrue, it willswitchitsstate,goingfrom offtoonandfrom on tooff. Therebyitsetsthe lightvariable sothattheledwillblink.76 +This model will start in the state lightOff. If the button is pressed, it will turn on the light and change to the corresponding state, where the light is turned off, as soon as the button is not pressed anymore. 68 68 69 -The annotations on the input and output variable are used to define which wrapper code is used to set / read them. **@Wrapper Clock,"500"** will set the input variable to true for one tickevery 500ms. **@WrapperDigitalWrite,"13"**will set pin13to HIGH if the variable istrueandtoLOWifit isfalse. We assumethatan **LEDis connected**to theArduino boardon **pin13**.78 +The annotations on the input and output variable are used to define which wrapper code is used to set / read them. **@Wrapper TouchSensor, S4** will set the input variable to true iff the touch sensor on the port S4 is pressed. **@Wrapper Floodlight, S1** on the output variable will turn on the red led of the light sensor that is attatched to port S1 iff the variable is true. 70 70 71 71 The available wrapper code snippets are defined in the //snippets// directory of the project in ftl files (FreeMarker template files). The table below gives an overview of the available wrapper code snippets. 72 72 82 +**Note:** The Floodlight of the EV3 has a pretty high latency when switching between on and off. 83 + 73 73 **Note: **To view ftl files with highlighting, you may want to install the //FreeMarker IDE// feature from the JBoss Tools. However, this is not necessary to work with KIELER. JBoss Tools is available in the Eclipse Market Place and via update site. The update site for Eclipse Luna is [[http:~~/~~/download.jboss.org/jbosstools/updates/stable/luna/>>url:http://download.jboss.org/jbosstools/updates/stable/luna/||shape="rect"]] . Note that only the //FreeMarker IDE// feature is required (Abridged JBoss Tools > FreeMarker IDE).** 74 74 ** 75 75 ... ... @@ -77,7 +77,7 @@ 77 77 78 78 With the mouse over the SCT file in the project explorer, perform //Right Click > Run As > KiCo Compilation.// 79 79 80 -A launch config is created, which compiles the model to Ccode and creates wrapper code from the annotations in the model file. Afterwards this output is compiled and deployed to theArduino board, by using the launch shortcut from theArduinoPlugin. If any errors occur, you can see them in the Console View.91 +A launch config is created, which compiles the model to Java code and creates wrapper code from the annotations in the model file. Afterwards this output is compiled and deployed to the Mindstorms brick, by using the launch shortcut from the leJOS plugin. If any errors occur, you can see them in the Console View. 81 81 82 82 For a deeper understanding of the project launch and initialization, take a look at the [[wiki page for Prom>>url:http://rtsys.informatik.uni-kiel.de/confluence/pages/viewpage.action?pageId=13762626||shape="rect"]]. 83 83 ... ... @@ -85,6 +85,10 @@ 85 85 86 86 There are several wrapper code snippets that can be used as annotations on input and output variables in the model file. These snippets are inserted in the main file template as part of the project launch. The available snippets are listed below. 87 87 99 +For sensors, the port has to be on of S1, S2, S3, S4. 100 + 101 +For motors / actuators the port has to be one of A, B, C, D. 102 + 88 88 |=((( 89 89 Snippet Name and Parameters 90 90 )))|=((( ... ... @@ -105,7 +105,7 @@ 105 105 **Clock,** milliseconds 106 106 )))|(% colspan="1" %)(% colspan="1" %) 107 107 ((( 108 -Sets a variable to true if the time in milliseconds passed .123 +Sets a variable to true if the time in milliseconds passed 109 109 )))|(% colspan="1" %)(% colspan="1" %) 110 110 ((( 111 111 input ... ... @@ -145,13 +145,13 @@ 145 145 **Time** 146 146 )))|(% colspan="1" %)(% colspan="1" %) 147 147 ((( 148 -Reads the elapsed time since program start in milliseconds.163 +Reads the elapsed time since program start 149 149 )))|(% colspan="1" %)(% colspan="1" %) 150 150 ((( 151 151 input 152 152 )))|(% colspan="1" %)(% colspan="1" %) 153 153 ((( 154 - unsigned169 +int 155 155 )))|(% colspan="1" %)(% colspan="1" %) 156 156 ((( 157 157 ... ... @@ -172,10 +172,10 @@ 172 172 input 173 173 )))|(% colspan="1" %)(% colspan="1" %) 174 174 ((( 175 - unsigned190 +int 176 176 )))|(% colspan="1" %)(% colspan="1" %) 177 177 ((( 178 -Should be used on the very first input variable in the model, s othat waiting is the last action in the tick loop.193 +Should be used on the very first input variable in the model, such that waiting is the last action in the tick loop. 179 179 )))|(% colspan="1" %)(% colspan="1" %) 180 180 ((( 181 181 timing.ftl ... ... @@ -182,17 +182,16 @@ 182 182 ))) 183 183 |(% colspan="1" %)(% colspan="1" %) 184 184 ((( 185 -**Delay 186 -** 200 +**Sleep** 187 187 )))|(% colspan="1" %)(% colspan="1" %) 188 188 ((( 189 -Lets the programdelaythe time in milliseconds of the variable value.203 +Lets the current thread sleep the time in milliseconds of the variable value. 190 190 )))|(% colspan="1" %)(% colspan="1" %) 191 191 ((( 192 192 output 193 193 )))|(% colspan="1" %)(% colspan="1" %) 194 194 ((( 195 - unsigned209 +int 196 196 )))|(% colspan="1" %)(% colspan="1" %) 197 197 ((( 198 198 ... ... @@ -202,20 +202,19 @@ 202 202 ))) 203 203 |(% colspan="1" %)(% colspan="1" %) 204 204 ((( 205 -**SerialRate,** baud** 206 -** 219 +**Print,** autoReset 207 207 )))|(% colspan="1" %)(% colspan="1" %) 208 208 ((( 209 - Sets thebaudrate forcommunication.This isdoneonlyinthe initilization,not in theloop.222 +Prints a string variable if the string is not empty. If autoReset is true then the string variable is set to the empty string after it has been printed 210 210 )))|(% colspan="1" %)(% colspan="1" %) 211 211 ((( 212 212 output 213 213 )))|(% colspan="1" %)(% colspan="1" %) 214 214 ((( 215 - unsigned228 +string 216 216 )))|(% colspan="1" %)(% colspan="1" %) 217 217 ((( 218 - 231 +autoReset is true per default. 219 219 )))|(% colspan="1" %)(% colspan="1" %) 220 220 ((( 221 221 print.ftl ... ... @@ -222,10 +222,10 @@ 222 222 ))) 223 223 |(% colspan="1" %)(% colspan="1" %) 224 224 ((( 225 -** Print**238 +**DrawString,** x, y 226 226 )))|(% colspan="1" %)(% colspan="1" %) 227 227 ((( 228 -Prints a string variableifthestringisnot0.241 +Prints a string to the given x and y coordinate on the LCD. 229 229 )))|(% colspan="1" %)(% colspan="1" %) 230 230 ((( 231 231 output ... ... @@ -239,53 +239,252 @@ 239 239 ((( 240 240 print.ftl 241 241 ))) 242 -|((( 243 -**DigitalWrite,** pin 244 -)))|((( 245 -Sets the pin value to HIGH if the variable is true and to LOW otherwise. 246 -)))|((( 255 +|(% colspan="1" %)(% colspan="1" %) 256 +((( 257 +**Button, **buttonId 258 +)))|(% colspan="1" %)(% colspan="1" %) 259 +((( 260 +Sets a variable to true iff the button on the Mindstorms device is pressed. 261 +)))|(% colspan="1" %)(% colspan="1" %) 262 +((( 263 +input 264 +)))|(% colspan="1" %)(% colspan="1" %) 265 +((( 266 +bool 267 +)))|(% colspan="1" %)(% colspan="1" %) 268 +((( 269 +The buttonId has to be one of ENTER, LEFT, RIGHT 270 +)))|(% colspan="1" %)(% colspan="1" %) 271 +((( 272 +touch_and_buttons.ftl 273 +))) 274 +|(% colspan="1" %)(% colspan="1" %) 275 +((( 276 +**TouchSensor**, port 277 +)))|(% colspan="1" %)(% colspan="1" %) 278 +((( 279 +Sets a variable to true iff the touch sensor on the given port is pressed. 280 +)))|(% colspan="1" %)(% colspan="1" %) 281 +((( 282 +input 283 +)))|(% colspan="1" %)(% colspan="1" %) 284 +((( 285 +bool 286 +)))|(% colspan="1" %)(% colspan="1" %) 287 +((( 288 + 289 +)))|(% colspan="1" %)(% colspan="1" %) 290 +((( 291 +touch_and_buttons.ftl 292 +))) 293 +|(% colspan="1" %)(% colspan="1" %) 294 +((( 295 +**LightSensor,** port, percentValue 296 +)))|(% colspan="1" %)(% colspan="1" %) 297 +((( 298 +Reads the value of a light sensor. 299 + 300 +If percentValue is true, the a percent value is retured, based on the light sensor calibration. 301 +)))|(% colspan="1" %)(% colspan="1" %) 302 +((( 303 +input 304 +)))|(% colspan="1" %)(% colspan="1" %) 305 +((( 306 +int 307 +)))|(% colspan="1" %)(% colspan="1" %) 308 +((( 309 +percentValue is not available on EV3 310 +)))|(% colspan="1" %)(% colspan="1" %) 311 +((( 312 +light.ftl 313 +))) 314 +|(% colspan="1" %)(% colspan="1" %) 315 +((( 316 +**CalibrateLightSensor,** port, signal 317 +)))|(% colspan="1" %)(% colspan="1" %) 318 +((( 319 +Calibrates a light sensors high or low values. This means if the variable is true, the current value of the light sensor is taken as its reference high / low value. 320 +)))|(% colspan="1" %)(% colspan="1" %) 321 +((( 247 247 output 248 -)))|((( 323 +)))|(% colspan="1" %)(% colspan="1" %) 324 +((( 249 249 bool 250 -)))|((( 326 +)))|(% colspan="1" %)(% colspan="1" %) 327 +((( 328 +signal has to be one of High, Low 329 +)))|(% colspan="1" %)(% colspan="1" %) 330 +((( 331 +light.ftl 332 +))) 333 +|(% colspan="1" %)(% colspan="1" %) 334 +((( 335 +**Floodlight,** port 336 +)))|(% colspan="1" %)(% colspan="1" %) 337 +((( 338 +Reads / Sets the state of the red lamp of the light sensor. 339 +)))|(% colspan="1" %)(% colspan="1" %) 340 +((( 341 +input 342 + 343 +output 344 +)))|(% colspan="1" %)(% colspan="1" %) 345 +((( 346 +bool 347 +)))|(% colspan="1" %)(% colspan="1" %) 348 +((( 251 251 252 -)))|((( 253 -read_and_write.ftl 350 +)))|(% colspan="1" %)(% colspan="1" %) 351 +((( 352 +light.ftl 254 254 ))) 255 -|((( 256 -**DigitalRead,** pin 257 -)))|((( 258 -Sets the variable value to the pin state (HIGH or LOW). 259 -)))|((( 354 +|(% colspan="1" %)(% colspan="1" %) 355 +((( 356 +**RCXLamp,** port 357 +)))|(% colspan="1" %)(% colspan="1" %) 358 +((( 359 +Turns an RCX lamp on (variable is true) or off (variable is false) 360 +)))|(% colspan="1" %)(% colspan="1" %) 361 +((( 362 +output 363 +)))|(% colspan="1" %)(% colspan="1" %) 364 +((( 365 +bool 366 +)))|(% colspan="1" %)(% colspan="1" %) 367 +((( 368 + 369 +)))|(% colspan="1" %)(% colspan="1" %) 370 +((( 371 +light.ftl 372 +))) 373 +|(% colspan="1" %)(% colspan="1" %) 374 +((( 375 +**MotorSpeed,** port, brake 376 +)))|(% colspan="1" %)(% colspan="1" %) 377 +((( 378 +Reads / Sets the speed of the motor in degrees per minute. If the speed value is negative, the motor will drive backwards. If the speed is zero, the motor will actively brake until it stops (brake is true) or remove all power and rollout (brake is false). 379 +)))|(% colspan="1" %)(% colspan="1" %) 380 +((( 260 260 input 261 -)))|((( 382 + 383 +output 384 +)))|(% colspan="1" %)(% colspan="1" %) 385 +((( 386 +int 387 +)))|(% colspan="1" %)(% colspan="1" %) 388 +((( 389 +brake is true per default. 390 +)))|(% colspan="1" %)(% colspan="1" %) 391 +((( 392 +motor.ftl 393 +))) 394 +|(% colspan="1" %)(% colspan="1" %) 395 +((( 396 +**MotorIsMoving,** port 397 +)))|(% colspan="1" %)(% colspan="1" %) 398 +((( 399 +Sets a variable to true iff the motor on the given port is moving. 400 +)))|(% colspan="1" %)(% colspan="1" %) 401 +((( 402 +input 403 +)))|(% colspan="1" %)(% colspan="1" %) 404 +((( 262 262 bool 263 -)))|((( 406 +)))|(% colspan="1" %)(% colspan="1" %) 407 +((( 264 264 265 -)))|((( 266 -read_and_write.ftl 409 +)))|(% colspan="1" %)(% colspan="1" %) 410 +((( 411 +motor.ftl 267 267 ))) 268 -|((( 269 -**Analog**Write, pin 270 -)))|((( 271 -Sets the voltage of the given analog IO pin via pulse-width modulation (PWM). Integers from 0 to 1023 are linearly mapped to an pseudo voltage from 0V to 5V. 272 -)))|((( 413 +|(% colspan="1" %)(% colspan="1" %) 414 +((( 415 +**MotorRotation,** port 416 +)))|(% colspan="1" %)(% colspan="1" %) 417 +((( 418 +Lets a motor rotate the variable value in degrees. This is only done if the value is unequal zero. If the value is negative, the motor rotates backwards. The variable is set to zero afterwards, such that setting the variable once to a value //X//, will let the motor rotate //X// degrees. 419 +)))|(% colspan="1" %)(% colspan="1" %) 420 +((( 273 273 output 274 -)))|((( 422 +)))|(% colspan="1" %)(% colspan="1" %) 423 +((( 275 275 int 276 -)))|((( 425 +)))|(% colspan="1" %)(% colspan="1" %) 426 +((( 277 277 278 -)))|((( 279 -read_and_write.ftl 428 +)))|(% colspan="1" %)(% colspan="1" %) 429 +((( 430 +motor.ftl 280 280 ))) 281 281 |(% colspan="1" %)(% colspan="1" %) 282 282 ((( 283 -** AnalogRead,**pin434 +**Beep,** volume 284 284 )))|(% colspan="1" %)(% colspan="1" %) 285 285 ((( 286 - Readsthe valueof thegivenanalog IO pin.Voltage from 0V to 5V is linearlymappedto an integervaluefrom0to 1023.437 +Plays a beep sound as long as the variable is true. 287 287 )))|(% colspan="1" %)(% colspan="1" %) 288 288 ((( 440 +output 441 +)))|(% colspan="1" %)(% colspan="1" %) 442 +((( 443 +bool 444 +)))|(% colspan="1" %)(% colspan="1" %) 445 +((( 446 +default volume is 10 447 +)))|(% colspan="1" %)(% colspan="1" %) 448 +((( 449 +sound.ftl 450 +))) 451 +|(% colspan="1" %)(% colspan="1" %) 452 +((( 453 +**Buzz,** volume 454 +)))|(% colspan="1" %)(% colspan="1" %) 455 +((( 456 +Plays a buzz sound as long as the variable is true. 457 +)))|(% colspan="1" %)(% colspan="1" %) 458 +((( 459 +output 460 +)))|(% colspan="1" %)(% colspan="1" %) 461 +((( 462 +bool 463 +)))|(% colspan="1" %)(% colspan="1" %) 464 +((( 465 +default volume is 10 466 +)))|(% colspan="1" %)(% colspan="1" %) 467 +((( 468 +sound.ftl 469 +))) 470 +|(% colspan="1" %)(% colspan="1" %) 471 +((( 472 +**BeepSequence,** direction, volume 473 +)))|(% colspan="1" %)(% colspan="1" %) 474 +((( 475 +Plays a sequence of tones in either ascending or descending tone frequency if the variable is true. 476 + 477 +The variable is set to false automatically. 478 +)))|(% colspan="1" %)(% colspan="1" %) 479 +((( 480 +output 481 +)))|(% colspan="1" %)(% colspan="1" %) 482 +((( 483 +bool 484 +)))|(% colspan="1" %)(% colspan="1" %) 485 +((( 486 +direction has to be one of Up, Down 487 + 488 +default volume is 10 489 +)))|(% colspan="1" %)(% colspan="1" %) 490 +((( 491 +sound.ftl 492 +))) 493 +|(% colspan="1" %)(% colspan="1" %) 494 +((( 495 +**UltrasonicSensor,** port 496 +)))|(% colspan="1" %)(% colspan="1" %) 497 +((( 498 +Reads the distance that an ultrasonic sensor measures. 499 +)))|(% colspan="1" %)(% colspan="1" %) 500 +((( 289 289 input 290 290 )))|(% colspan="1" %)(% colspan="1" %) 291 291 ((( ... ... @@ -295,21 +295,63 @@ 295 295 296 296 )))|(% colspan="1" %)(% colspan="1" %) 297 297 ((( 298 -r ead_and_write.ftl510 +ultrasonic.ftl 299 299 ))) 512 +|(% colspan="1" %)(% colspan="1" %) 513 +((( 514 +**Gyro,** port, mode 515 +)))|(% colspan="1" %)(% colspan="1" %) 516 +((( 517 +Reads the value of a gyroscope. 518 +)))|(% colspan="1" %)(% colspan="1" %) 519 +((( 520 +input 521 +)))|(% colspan="1" %)(% colspan="1" %) 522 +((( 523 +int 524 +)))|(% colspan="1" %)(% colspan="1" %) 525 +((( 526 +Not available on NXT 300 300 301 ----- 528 +mode hat to be one of Angle, Rate 529 +)))|(% colspan="1" %)(% colspan="1" %) 530 +((( 531 +gyro.ftl 532 +))) 533 +|(% colspan="1" %)(% colspan="1" %) 534 +((( 535 +**CalibrateGyro,** port, autoReset 536 +)))|(% colspan="1" %)(% colspan="1" %) 537 +((( 538 +Resets a gyroscope if the variable is true. 302 302 303 -== Using the Serial Monitor == 540 +If autoReset is true, the variable is set to false automatically. 541 +)))|(% colspan="1" %)(% colspan="1" %) 542 +((( 543 +output 544 +)))|(% colspan="1" %)(% colspan="1" %) 545 +((( 546 +bool 547 +)))|(% colspan="1" %)(% colspan="1" %) 548 +((( 549 +autoReset is true per default 550 +)))|(% colspan="1" %)(% colspan="1" %) 551 +((( 552 +gyro.ftl 553 +))) 304 304 305 - TheArduino Eclipse Plugin has a Serial Monitor (Window > Show View > Other > Arduino > Serial monitor view). Here you can open connections to serial ports and read and write to them.555 + 306 306 307 - To open a connection, click the plus button and select the serial port you want to conenct to as well as the serial rate that is used to transmit data. Click //OK.//557 +---- 308 308 309 - The output of all openconnectionswill becombinedin the text editor.559 +== Using the Remote Console (RConsole) == 310 310 311 - [[image:attach:Screenshot_20160509_125654.png]]561 +The display of the **NXT brick** is rather small compared to a Monitor. To ease debugging, one can print to a Remote Console (RConsole), if the USB cable is connected. This enables easier collection for example of sensor data. 312 312 563 +To use the RConsole, **uncomment** the **RConsole** lines in the wrapper code template **Main.ftl**. Start the **nxjconsoleviewer** tool in the bin directory of your **leJOS installation**. Now, when **starting the application**, the brick tries to connect with the nxjconsoleviewer. **Press the //Connect//** button. If connected succesfully, RConsole.println(...) commands will be written to this window. 564 + 565 +The **EV3 brick** has a similar feature. However it does not require any code changes. Just run the ev3console program in the bin directory of your leJOS installation from command line. The output of the brick will be printed to this command line. 566 + 313 313 ---- 314 314 315 315 == Problem Solving == ... ... @@ -326,13 +326,52 @@ 326 326 Solution 327 327 ))) 328 328 |((( 329 - Theuploadprotocol is not set583 +leJOS EV3 does not support Java 8 330 330 )))|((( 331 -avrdude: Error: Could not find USBtiny device (0x1781/0xc9f) 332 -)))|((( 333 -You launch a project and there is no different behaviour although there are changes in code. 585 +"java.lang.UnsupportedClassVersionError" 334 334 335 - Youtry to launch theprojectandcompilation finishes successful. HoweverTheupload fails because the upload protocol isnot correctly configured.587 +"unsupported major.minor version" 336 336 )))|((( 337 -Go to the project properties and select //Default// in the field //Upload Protocol// (Right click on project > Properties > Arduino > Arduino Board Selection) 589 +You compile the sources in your project with Java 8 and upload them to the brick. However the lejos EV3 does not support Java 8 590 +)))|((( 591 +Go to the project properties and switch to Java 7 (Right Click on project > Properties > Java Compiler > Compiler compliance level) 338 338 ))) 593 +|(% colspan="1" %)(% colspan="1" %) 594 +((( 595 +Uploading to the brick does not respond 596 +)))|(% colspan="1" %)(% colspan="1" %) 597 +((( 598 + 599 +)))|(% colspan="1" %)(% colspan="1" %) 600 +((( 601 +You compile a file successfully and when uploading the result, the connected brick is found. Anyway the upload does not terminate and does not react. 602 +)))|(% colspan="1" %)(% colspan="1" %) 603 +((( 604 +Flash the brick with the current leJOS firmware. If the brick is recognized correctly and the attempt to upload a compiled file fails then the firmware on the brick might be outdated. 605 +))) 606 +|(% colspan="1" %)(% colspan="1" %) 607 +((( 608 +Compilation and uploading works from command line but not when using KIELER 609 +)))|(% colspan="1" %)(% colspan="1" %) 610 +((( 611 +This Java instance does not support a 32-bit JVM. Please install the desired version. 612 +)))|(% colspan="1" %)(% colspan="1" %) 613 +((( 614 +You can compile and upload code to the brick using the command line tools but when using KIELER an error message apprears because Java does not support 32-bit JVM. 615 +)))|(% colspan="1" %)(% colspan="1" %) 616 +((( 617 +Set the LEJOS_NXT_JAVA_HOME environment variable, such that it points to an 32-bit JDK and is visible for GUI applications (or at least KIELER). The process to do so differs on every OS. As alternative, execute KIELER from terminal. 618 +))) 619 +|(% colspan="1" %)(% colspan="1" %) 620 +((( 621 +Brick does nothing after program finished and prints "Program exit" 622 +)))|(% colspan="1" %)(% colspan="1" %) 623 +((( 624 + 625 +)))|(% colspan="1" %)(% colspan="1" %) 626 +((( 627 +A program was uploaded and finished without errors. Afterwards the brick prints "Program exit" but does not open the main menu. 628 +)))|(% colspan="1" %)(% colspan="1" %) 629 +((( 630 +This is normal behaviour if uploading a program in debug mode instead run mode (//Debug As// instead //Run As// in Eclipse). To get back to the main menu, press the ENTER and ESCAPE button of the brick at the same time. 631 +)))
- Confluence.Code.ConfluencePageClass[0]
-
- Id
-
... ... @@ -1,1 +1,1 @@ 1 -1 73998471 +16810566 - URL
-
... ... @@ -1,1 +1,1 @@ 1 -https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/KIELER/pages/1 7399847/Arduino and SCCharts1 +https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/KIELER/pages/16810566/Arduino and SCCharts