ebook img

MATLAB Support Package for Arduino Hardware User's Guide PDF

132 Pages·2014·7.02 MB·English
by  
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview MATLAB Support Package for Arduino Hardware User's Guide

® ® MATLAB Support Package for Arduino Hardware User’s Guide R2014a How to Contact MathWorks Latest news: www.mathworks.com Sales and services: www.mathworks.com/sales_and_services User community: www.mathworks.com/matlabcentral Technical support: www.mathworks.com/support/contact_us Phone: 508-647-7000 The MathWorks, Inc. 3 Apple Hill Drive Natick, MA 01760-2098 MATLAB® Support Package for Arduino® Hardware User’s Guide © COPYRIGHT 1984–2014 by The MathWorks, Inc. The software described in this document is furnished under a license agreement. The software may be used or copied only under the terms of the license agreement. No part of this manual may be photocopied or reproduced in any form without prior written consent from The MathWorks, Inc. FEDERAL ACQUISITION: This provision applies to all acquisitions of the Program and Documentation by, for, or through the federal government of the United States. By accepting delivery of the Program or Documentation, the government hereby agrees that this software or documentation qualifies as commercial computer software or commercial computer software documentation as such terms are used or defined in FAR 12.212, DFARS Part 227.72, and DFARS 252.227-7014. Accordingly, the terms and conditions of this Agreement and only those rights specified in this Agreement, shall pertain to and govern the use, modification, reproduction, release, performance, display, and disclosure of the Program and Documentation by the federal government (or other entity acquiring for or through the federal government) and shall supersede any conflicting contractual terms or conditions. If this License fails to meet the government's needs or is inconsistent in any respect with federal procurement law, the government agrees to return the Program and Documentation, unused, to The MathWorks, Inc. Trademarks MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See www.mathworks.com/trademarks for a list of additional trademarks. Other product or brand names may be trademarks or registered trademarks of their respective holders. Patents MathWorks products are protected by one or more U.S. patents. Please see www.mathworks.com/patents for more information. Revision History September 2014 Online only New for Version 14.1.0 (R2014a) Contents Setup and Configuration 1 Install Support for Arduino Hardware . . . . . . . . . . . . . . . . . . 1-2 Install the Support Package . . . . . . . . . . . . . . . . . . . . . . . . . 1-2 Accessing Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5 Arduino Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-6 Read Write Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-6 Supported Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-7 Connect to Arduino Hardware . . . . . . . . . . . . . . . . . . . . . . . . 1-8 Read and Write to Digital Pin . . . . . . . . . . . . . . . . . . . . . . . . . 1-9 Play a Tone on a Piezo Speaker . . . . . . . . . . . . . . . . . . . . . . 1-10 Control LEDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-11 I2C Sensors 2 Arduino I2C Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2 I2C Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3 Communicate With an I2C Device Using EEPROM Data . . . 2-4 iii SPI Sensors 3 Arduino and SPI Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2 SPI Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2 Servo Motors 4 Servo Motors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2 Servo Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2 Rotate a Servo Motor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3 Add-On Shields 5 Add-On Shields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2 Add-On Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2 Functions — Alphabetical List 6 Troubleshooting 7 Cannot Auto Detect Arduino hardware . . . . . . . . . . . . . . . . . 7-2 Update Device Driver on a Windows System . . . . . . . . . . . . . 7-2 iv Contents Unsupported Device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2 Manual disconnect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2 Why do I need to specify board type and port? . . . . . . . . . . . 7-3 Find port number on Windows . . . . . . . . . . . . . . . . . . . . . . . 7-3 Find port number on Macintosh . . . . . . . . . . . . . . . . . . . . . . 7-4 My I2C server code hangs . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-5 I lost my Arduino connection . . . . . . . . . . . . . . . . . . . . . . . . . 7-6 Unplugged hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-6 Board with low data memory . . . . . . . . . . . . . . . . . . . . . . . . 7-6 Too many device objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-6 Pin is Not Receiving Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-7 I see strange data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-8 Pin not receiving proper signal . . . . . . . . . . . . . . . . . . . . . . . 7-8 Board with low data memory . . . . . . . . . . . . . . . . . . . . . . . . 7-8 Incorrect input or output . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-8 Problems using pulse duration setting on Servo . . . . . . . . . . 7-9 My Servo Pulse is Not Working . . . . . . . . . . . . . . . . . . . . . . . 7-10 Hardware reserved error . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-11 Cannot stack motor shields . . . . . . . . . . . . . . . . . . . . . . . . . . 7-12 My Stepper is Not Rotating . . . . . . . . . . . . . . . . . . . . . . . . . . 7-13 My Motor is Not Working . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-14 I Need More Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-15 Examples 8 v 1 Setup and Configuration • “Install Support for Arduino Hardware” on page 1-2 • “Accessing Examples” on page 1-5 • “Arduino Hardware” on page 1-6 • “Supported Hardware” on page 1-7 • “Connect to Arduino Hardware” on page 1-8 • “Read and Write to Digital Pin” on page 1-9 • “Play a Tone on a Piezo Speaker” on page 1-10 • “Control LEDs” on page 1-11 1 Setup and Configuration Install Support for Arduino Hardware Install the MATLAB® Support Package for Arduino® Hardware to add support for Arduino hardware. The installation adds these items on your host computer: • Third-party software development tools • MATLAB commands • Examples When you complete installation, you can use MATLAB commands to control, and retrieve data from, Arduino hardware and peripherals. Install the Support Package This example shows how to add support for Arduino hardware to the MATLAB product. After you complete this process, you can run MATLAB code on your Arduino hardware. To install support for Arduino hardware: 1 In a MATLAB Command window, enter supportPackageInstaller to open the Support Package Installer. 2 Follow the instructions and default settings provided by Support Package Installer to complete the installation. For more information about the options on a particular screen, click the Help button. 3 When the installation is complete Windows users may see a Setup Support Package screen. 1-2 Install Support for Arduino Hardware 4 Click next to set up the support package. The installer prompts you for an Arduino Driver Installation. 1-3 1 Setup and Configuration 5 If you have administrative privileges, select Enable Installation of Arduino USB Driver and click next. The installation process adds the following items to your host computer: • Third-party software development tools, such as the Arduino software • Additional driver and firmware. • Examples for getting started and learning about specific features Note: If you do not have administrative privileges or do not wish to update your drivers, you can skip this step and update later using the targetupdater command. To update, repeat these steps. 1-4

Description:
Add-on shields are boards you can plug on to Arduino hardware and extend the hardware capabilities. With Shields you can control motors from your board. Currently you can use. Adafruit Motorshields V2 with MATLAB Support Package for Arduino Hardware. Add-On Functions arduino addon dcmotor
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.