Example 3: MATLAB

The third example below shows how it is possible to install hardware support for Arduino into Matlab using the hardware support package and then directly control the output pin connected to the Extender.

  1. Download and install Arduino Hardware support package on MATLAB.

  2. Connect the Arduino board to the PC. To establish a connection between MATLAB and Arduino boards, the following command can be used from MATLAB:

    >> a = arduino
  3. The arduino support package can control the arduino in multiple different ways. For this example we are using Digital pin 9 and using the writeDigitalPin command. See example below.

    writeDigitalPin(a, D9, 1)
    writeDigitalPin(a, D9, 0)

This will create a rising edge which will trigger the extender port. You can incorporate this into your code.

Last updated