arduino engineering kit invalid i2c address formatt
이전 댓글 표시
hello! i am trying to complete the arduino engineering kit using matlab 2019 and simulink
here is a link to where i currently am, down in the section of that page where you connect the arduino board to matlink to control that little geared motor.
"As you switched the MKR1000 board's power source from USB to LiPo battery, you must re-establish your MATLAB connection to Arduino. Run the following commands to do so:
>> clear a
>> a = arduino
Now let's create a second MATLAB object to provide access to the MKR Motor Carrier. Use the following command to create a Carrier object in the MATLAB Workspace that is associated with the Arduino object a :
>> carrier = addon(a, 'Arduino/MKRMotorCarrier')
Just as the MKR Motor Carrier provides a physical interface between the motor drive wiring and the MKR1000 board, the carrier object is an intermediary between the Arduino object and the DC and servo motors we may connect.
The Motor Carrier allows you to drive your motors with a relatively powerful battery. This can provide much larger currents than the Arduino board itself, which derives all its power from the USB connection to your computer. The USB port cannot provide enough current to drive motors at the necessary voltage, and it can be dangerous to attempt to do so.
Now let's create a third object to give you control of the motor connected to M3 in MATLAB. Use the following command to create a DC Motor object that is associated with the Carrier object, and examine the displayed object properties in theCommand Window :
>> dcm = dcmotor(carrier,3)
when i follow these directions exactly and even copy and paste the commands from the tutorial it gives me this error when trying to access the MKRMotorCarrier library.
>> clear a
>> a = arduino
a =
arduino with properties:
Port: 'COM8'
Board: 'MKR1000'
AvailablePins: {'D0-D14', 'A0-A6'}
AvailableDigitalPins: {'D0-D14', 'A0-A6'}
AvailablePWMPins: {'D0-D8', 'D10', 'A3-A4'}
AvailableAnalogPins: {'A0-A6'}
AvailableI2CBusIDs: [0]
Libraries: {'Arduino/MKRMotorCarrier', 'I2C', 'RotaryEncoder', 'SPI', 'Servo', 'Ultrasonic'}
>> carrier = addon(a, 'Arduino/MKRMotorCarrier')
Invalid I2C address format. The address must be a scalar integer (or hex character vector or string) between 0
and 127.
what am i doing wrong? or has something been updated to make this tutorial invalid?
채택된 답변
추가 답변 (4개)
Madhu Govindarajan
2019년 4월 16일
2 개 추천
The tutorial is still valid as I am using it in R2019a, so let's try and see where the error is coming from.
Type the following in MATLAB and share the output:
matlabshared.supportpkg.getInstalled
tbx = matlab.addons.toolbox.installedToolboxes
tbx.Name
tbx.Version
Kevin Graebner
2019년 4월 23일
0 개 추천
댓글 수: 1
Madhu Govindarajan
2019년 4월 23일
Have you tried putting the board in bootloader mode and making Simulink select the COM port Automatically. Here are the steps to try:
1) Double press the reset button on your Arduino board.
2) Open up Device Manager and check if the board is now detected in boot loader mode. If not repeat Step 1 till it changes to boot loader mode.
3) Go to Simulink model, Configuration Parameters > Hardware Implementation > Hardware board settings > Target hardware resources > Host-board connection > Set host COM port > Automatically and click OK.
4) Ensure the mdoel is in external mode and press play.
카테고리
도움말 센터 및 File Exchange에서 I2C Devices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!