Arduino mega 2560 Pin 9 issue
Show older comments
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
Mihai Bodolea
on 15 Feb 2021
Hi there,
were you able to find a sollution or to figure out why Simulink is having this issue? I'm also struggling with this error and I have no idea what is wrong.
Thanks in advance!
Wasim Ekram
on 10 May 2022
Any solutions for ths issue?
Leo
on 4 Mar 2023
same problem here with 2022b
Ali mohsen
on 7 May 2023
same issue MATLAB2023a
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'
Answers (1)
Salah
on 23 Sep 2022
0 votes
I am facing the same exact error but on Ubuntu with latest version of Matlab. I wish there is a solution
1 Comment
Muhammad Qureshi
on 7 Mar 2023
Any luck? I have the very same problem
Categories
Find more on Arduino Hardware in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!