Skip to content

DBDBDDB/Modelica-Arduino

 
 

Repository files navigation

Simulate Arduino Sketches in Modelica

With the Arduino Modelica library you can simulate your circuits and sketches on a virtual Arduino Uno and connect your Modelica models to real-world circuits using the Firmata protocol.

Prerequisites

  • Dymola 2017 FD01 or 2018
  • Visual Studio 2015

Getting Started

  • download the latest release and extract the archive
  • in Dymola select File > Open... and open Arduino/package.mo from the extracted files
  • in the package browser double-click Arduino.Examples.Blink
  • right-click on the toolbar and check Simulation and Animation to view the simulation and animation toolbars
  • click Simulate Button to run the Simulation
  • after the simulation has finished click Run Button in the animation toolbar and watch the LED L blink
  • try the other examples in Arduino.Examples

Simulate your Sketch

To simulate your sketch MySketch you have to perform the following steps.

  • save your sketch as Sketches/MySketch.ino
  • add the block Arduino.Components.ArduinoUno to your model
  • double-click the block and set the parameter sketch to "MySketch.ino"

Limitations

Arduino Libraries

The following libraries are included and can be used directly.

Name Description
Servo.h Servo library to control RC (hobby) servo motors
Braccio.h control the Braccio robot arm
PID_v1.h PID controller library for Arduino

To use an external library in your sketch copy its header files (*.h) and source files (*.cpp) to the Libraries folder. If the library contains .cpp files you have to add them to the Arduino project by dragging them from the Libraries folder in the file browser onto the Source Files folder in the solution explorer.

License

The code is licensed GPLv3, the documentation CC BY-SA 4.0.


Developed by Torsten Sommer at Dassault Systèmes. Copyright © 2017 Dassault Systèmes.

About

Simulate circuits and sketches on a virtual Arduino Uno in Modelica

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Modelica 41.0%
  • C++ 32.3%
  • C 16.7%
  • Other 7.7%
  • Python 1.5%
  • CSS 0.5%
  • Batchfile 0.3%