WOLFRAM SYSTEM MODELER
UsingCustomBoardUsing a Firmata-compatible board |
SystemModel["ModelPlug.Examples.UsingCustomBoard"]
This example shows how to use a board with a custom version of Firmata. The Teensy board works perfectly with the StandardFirmata, but in this example it is modified in order get a faster data transfer speed.
The main difference of the CustomFirmata component is that it allows you to set the baud rate to the sampling interval that you want to use. In this case the oce of the StandardFirmata is modified to use a baud rate of 115200. You can perform this modification in the source code. Search for the line:
Firmata.Begin(57600);
and change it to
Firmata.Begin(115200);
This initializes the serial port at the given speed. The next change that you can make is reducing the minimum sampling interval. You can find this tweak by searching in the code for the text:
#define MINIMUM_SAMPLING_INTERVAL 10
and changing it to
#define MINIMUM_SAMPLING_INTERVAL 1
This changes the sampling interval limit from 10 ms to 1ms. This change is possible as the Teensy board can run up to 96 MHz. Whenever changing the sampling interval you also need to ensure that the sampling interval in Simulation Center matches it, as shown in the figure below.
booleanPulse |
Type: BooleanPulse Description: Generate pulse signal of type Boolean |
|
---|---|---|
digitalOutput |
Type: DigitalOutput Description: Writes a digital signal to the specified pin |
|
customFirmata |
Type: CustomFirmata Description: Component that allows custom configuration of the Firmata |