Arduino mega 2560 Pin 9 issue

1 view (last 30 days)
David Hughes
David Hughes on 30 Dec 2020
Commented: Walter Roberson on 7 May 2023
Hello,
I'm using the Simulink support package for Arduino Hardware and going through this example https://uk.mathworks.com/help/supportpkg/arduino/ref/communicating-with-arduino-hardware.html
communicating with arduino hardware.
I'm using Windows 10, 2020b, connecting by USB.
At "Task 3 - Simulate the Model
To simulate the model, follow these steps:
1. Observe that the model plays the motion energy recorded in a room and compares it with a threshold to detect intrusion.
2. In the model, change the Simulation mode on the toolbar to Normal. This tells Simulink to run the model on the host computer. See Task 4 below to run the model on the Arduino target hardware.
3. In the model, click the Run button in the Simulink toolbar."
For the suimulation mode is it this dropdown which includes 'Accelerator' and 'Fast Accelerator' in which case where is the 'External' mentioned in the following task?
If it is this then when used I am getting this error;
"MATLAB System block 'arduino_communication/Digital Output' error occurred when invoking 'setupImpl' method of 'codertarget.arduinobase.blocks.DigitalWrite'. The error was thrown from ' 'C:\ProgramData\MATLAB\SupportPackages\R2020b\toolbox\target\shared\devicedrivers\+matlabshared\+devicedrivers\+blocks\DigitalIO.p' at line 0'.
Caused by:
  • Configuring Pin 9 as Digital Input/Output failed. Pin 9 is not a valid Digital Input/Output pin. Reconnect the hardware, provide a valid Digital Input/Output pin number for your hardware and try again. "
Am I using the wrong Normal or is there an issue with Pin 9 on the Mega? The example states it is configured for the Mega already.
Thanks in advance.
  5 Comments
Ali mohsen
Ali mohsen on 7 May 2023
same issue MATLAB2023a
Walter Roberson
Walter Roberson on 7 May 2023
This is a bit odd, as pin 9 does appear to be a digital pin -- at least if it is being referred to as 'D9'

Sign in to comment.

Answers (1)

Salah
Salah on 23 Sep 2022
I am facing the same exact error but on Ubuntu with latest version of Matlab. I wish there is a solution

Categories

Find more on Arduino Hardware in Help Center and File Exchange

Tags

Products


Release

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!