Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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. Therefore we will first download and setup the development environment and afterwards create and upload a small example project.

If you want to learn the SCCharts langugage first, you can follow these links:

...

Download and Configure KIELER

...

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.

Snippet Name and ParametersDescriptionUse onVariable typeRemarkDefined in File
Clock, millisecondsSets a variable to true if the time in milliseconds passed.inputboolSee also ResetClock.timing.ftl
ResetClock, clockVariableName, autoFalse

Resets a clock, such that the full time intervall of the clock has to elapse, before the clock will be set to true again.

If autoFalse is true, the reset variable will be set to false automatically.

outputboolautoFalse is true per default.timing.ftl
TimeReads the elapsed time since program start in milliseconds.inputunsigned timing.ftl
TickDuration, targetInMilliseconds

Delays the execution until the tick loop takes at least as long as the given target duration.

The input variable is set to the actual tick loop duration.

inputunsignedShould be used on the very first input variable in the model, so that waiting is the last action in the tick loop.timing.ftl
Delay
Lets the program delay the time in milliseconds of the variable value.outputunsigned timing.ftl
SerialRate, baud
Sets the baud rate for communication. This is done only in the initilization, not in the loop.outputunsigned print.ftl
PrintPrints a string variable if the string is not 0.outputstring print.ftl
DigitalWrite, pinSets the pin value to HIGH if the variable is true and to LOW otherwise.outputbool read_and_write.ftl
DigitalRead, pinSets the variable value to the pin state (HIGH or LOW).inputbool read_and_write.ftl
AnalogWrite, pin

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.

outputint read_and_write.ftl
AnalogRead, pin

Reads the value of the given analog IO pin. Voltage from 0V to 5V is linearly mapped to an integer value from 0 to 1023.

inputint read_and_write.ftl

...

Using the Serial Monitor

The Arduino 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.

...

The following presents typical issues and how to solve them.

IssueTypical Error MessagesDescriptionSolution
The upload protocol is not setavrdude: Error: Could not find USBtiny device (0x1781/0xc9f)

You launch a project and there is no different behaviour on your Arduino device, although there are changes in code.

You try to launch the project and compilation finishes successful. However The upload fails because the upload protocol is not correctly configured.

Go to the project properties and select Default in the field Upload Protocol (Right click on project > Properties > Arduino > Arduino Board Selection)