Versions Compared

Key

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

...

  1. Choose File > New > Project > General > Project (do never convert your project in an Xtext-project)
  2. The project is created.
  3. Create a SCChart inside the project.
  4. Open the SCCharts modeling perspective (Window > Perspective > Open Perspective > Other)
  5. Edit the model
  6. Compile the model using the KIELER compiler

Edit the Model:

Change the contents of the model file to the following code and save it.

Code Block
languagesct
themeEclipse
titleFloodlight.sct
scchart Flashlight {
    
    input bool @macro "TouchSensorButton", "S4ENTER" button
    
    output bool @macro "Floodlight", "S1" light
    
    initial state lightOff
    if button do light = true go to lightOn
    
    state lightOn
    if !button do light = false go to lightOff
}

...

The annotations on the input and output variable are used to define which wrapper code is used to set / read them. @macro "TouchSensorButton", "S4ENTER" will set the input variable to true iff the touch sensor on the port S4 orange enter button is pressed. @macro "Floodlight", "S1" on the output variable will turn on the red led of the light sensor that is attached to port S1 iff the variable is true.

...

Note: The Floodlight of the EV3 has a pretty high latency when switching between on and off.

Compile the model:

...

Select the Netlist-Based Deployment (NXJ) or Netlist-Based Compilation Deployment (NXTNXJ) Bluetooth to deploy to the NXT. TODO change to correct name.

This compilation chain is accessible via the KIELER Compiler View.

...