Working With Arduino Hardware
Working With Arduino Hardware
In a MATLAB Command Window, enter targetinstaller. In a model, click the Tools menu, and select Run on Target Hardware > Install/Update Support Package.
2 Choose to get the support package from the Internet or from a folder.
Note The time required to downloading the support package and third-party software varies depending on the bandwidth and speed of your Internet connection.
1-2
Internet: This option is selected by default. Target Installer downloads and installs the support package and third-party software from the Internet. Folder: Target Installer gets the support package and third-party software installers from the specified folder. If the third-party software installers are not available, Target Installer downloads and installs those from the Internet. You must have write privileges for this folder. Having write privileges for the default folder is typically not an issue. If you change to a new folder for which you do not have write permissions, such as a shared folder on a network, Target Installer generates an error message. To solve this issue, copy the support package to a folder for which you have write privileges, and point Target Installer to that same folder. For example, copy the support package to C:\MATLAB\Targets\version\downloads. If they are available, also copy the third-party software installers associated with the support package. To locate the support package in a folder, search for a filename that begins with rtt_arduino and ends with .zip. For example:
rtt_arduinouno_r2012a_v1_0.zip
1-3
3 Select the Install check box for either Arduino target, and click Next >. (To
install another target, run Target Installer again later on.) The Installation folder parameter tells Target Installer where to install the target and associated third-party software. You must have write privileges for this folder.
1-4
4 Target Installer confirms that you are installing the target, and lists
third-party software it will install. Review the information, including the license agreements, and click Install.
1-5
Target Installer displays a progress bar while it downloads and installs the third-party software.
1-6
Note If you installed the target previously, Target Installer may remove files from that installation before installing the current target. If Target Installer cannot remove those files automatically, it instructs you to delete the files manually. Close the MATLAB software before removing the files. Then restart MATLAB software and run Target Installer again.
5 To view target demos, leave the Launch target demos checkbox selected
1-7
The Help that opens displays the appropriate demos for your hardware. To find these demos again later, enter doc in the MATLAB Command Window. In the Help that opens, look for Other Demos at the bottom of the Contents list.
1-8
1-9
1-10
In the Simulink Library Browser, click Target for Use with Arduino Hardware. Simulink Library Browser displays the corresponding block library.
1-11
This action automatically downloads and runs your model on the Arduino hardware. The lower left corner of the model window displays status while Simulink software prepares, downloads, and runs the model on the target hardware. To stop a model running on Arduino hardware, you can: Disconnect the power from the hardware. When you reconnect the power, the model will start running again. Run a new or updated model on the hardware. This action automatically stops and erases the previous model running on the Arduino hardware. To restart the model running on the Arduino hardware, press the RESET button on the board.
1-12
to Run.
3 Apply the same Configuration Parameters settings to the submodel as you
applied to the parent model. If the model and Model blocks have different settings, the software generates an error when you try to run the model on the target hardware.
See Also
Creating the Simple Model Tune and Monitor Models Running on Arduino Mega 2560 Hardware on page 1-14 Overview of Model Referencing
1-13
1-14
When you open blocks and apply new parameter values on the host computer, External mode updates the corresponding values in the model running on the target hardware. If your model contains blocks for viewing data, such as Scope or Display blocks, External mode sends the corresponding data from the target hardware to those blocks on the host computer.
You determine the optimal parameter settings by adjusting parameter values on the host computer and observing data/outputs from the target hardware. When you have finished tuning a model, you can disable External mode and run the tuned model on your hardware. Some limitations apply while you are using External mode: Do not configure Serial Receive or Serial Transmit blocks in your model to use serial port 0. External mode uses serial port 0. Do not use the following Arduino servo blocks: Standard Servo Read, Standard Servo Write, and Continuous Servo Write.
1-15
To run the model for an indefinite period, enter inf. To run the model for a finite period, enter a number of seconds. For example, entering 120 runs the model on the Arduino hardware for 2 minutes.
3 Click the Tools menu, and select Run on Target Hardware > Options. 4 In the Run on Target Hardware pane that opens, select the Enable
The lower left corner of the model window displays status while Simulink software prepares, downloads, and runs the model on the target hardware.
7 While the model is running in External mode, you can change tunable
parameter values in the model on your host computer and observe the corresponding changes in the model running on the hardware. If your model contains blocks from the Simulink Sinks block library, the sink blocks in the model on your host computer display the values generated by the model running on the hardware. If your model does not contain a sink block to which External mode can send data, the MATLAB Command Window displays a No data has been selected for uploading warning. You can disregard this warning, or you can add a sink block to the model and rerun your model.
8 When you have finished tuning and monitoring your model, you can disable
External mode. To deploy model to your hardware without using External mode. See Run Model on Arduino Hardware on page 1-12:
1-16
Note External mode increases the processing burden of the model running on the hardware. If the software reports an overrun, you can apply the solutions described in Detect and Fix Task Overruns on Arduino Hardware on page 1-21.
This action stops the process for the model running on the Arduino hardware, and stops the model simulation running on your host computer. If it is set to a finite period, the Simulation stop time parameter stops External mode when the period elapses.
1-17
Hardware
The Arduino Uno board has one serial port, serial port 0, connected to: The digital pins marked TX 1 (transmit) and RX 0 (receive). The USB port, through a serial-to-USB converter. The Arduino Mega 2560 board has four serial ports: Serial port 0 is connected to Communication pins marked TX0 1 (transmit) and RX0 0 (receive). Serial port 0 is also connected to the USB port through a converter. Serial port 1 is connected to Communication pins marked TX1 18 (transmit) and RX1 19 (receive). Serial port 2 is connected to Communication pins marked TX2 16 (transmit) and RX2 17 (receive). Serial port 3 is connected to Communication pins marked TX3 14 (transmit) and RX3 15 (receive). You can use serial port 0 to communicate with other devices that have serial ports, or to communicate with a computer over the USB port. Each serial port supports one Serial Transmit and one Serial Receive block, one block per pin.
1-18
If you intend to use External mode with Arduino Mega 2560 hardware, use serial ports 1 through 3 for serial communications. Serial port 0 is not available for serial communications because it is connected to the USB port, which External mode uses to communicate with the host computer. This restriction does not apply to Arduino Uno hardware, because External mode is not supported. For more information, see Tune and Monitor Models Running on Arduino Mega 2560 Hardware on page 1-14. Serial communications are not supported in models that also use the Arduino Standard Servo Read, Standard Servo Write, and Continuous Servo Write blocks. Warning Only connect serial port pins to devices that use 5 Volt TTL logic. Do not connect these pins to an RS-232 serial interface, such as the DE-9M connector on a computer, without limiting the voltage. The RS-232 standard allows higher voltages that can damage your hardware. For details, read the documentation for your Arduino hardware.
If the data type is not uint8, use a Data Type Conversion block to convert it to uint8.
3 In the Serial Transmit block, specify a Port number. 4 Click the Tools menu in the model, and select Run on Target Hardware
> Options. In the Configuration Parameters dialog that opens, set the baud rate parameter of the serial port you specified in the Serial Transmit block.
5 Connect the appropriate digital transmit pin, or the USB port, to the
1-19
> Options. In the Configuration Parameters dialog that opens, set the baud rate parameter of the serial port you specified in the Serial Receive block.
5 Connect the appropriate digital receive pin, or the USB port, to the
1-20
and Options.
2 In the Run on Target Hardware pane that opens, select the Enable
To create a visual overrun indicator for your board, connect an appropriate resistor in series with an LED between the GND and the hardware pin specified by the Digital output to set on overrun parameter. Orient the LED so the longer leg (positive) is connected to the digital output pin. When a task overrun occurs: The state of the digital output pin specified by the Digital output to set on overrun parameter changes from low (0 Volts) to high (5 Volts). The model continues running, but the effective sample time will be longer than specified. To fix an overrun condition, reduce the processing burden of the model by applying one or more of the following solutions: Increase the sample times for the model. For example, increase the values of the Sample time parameters in all of your data source blocks.
1-21
Simplify the model. If you are using External mode, and the preceding solutions do not fix the task overrun condition, consider clearing the Enable External mode checkbox in the Run on Target Hardware pane. External mode adds a lightweight server to the model running on the target hardware. This server increases the processing burden upon the target hardware, which can contribute to a task overrun condition.
1-22
host computer.
2 Try running the model again on your Arduino hardware.
1-23
If you get the error message while your board is powered on and connected to your host computer, resolve any issues with Arduino drivers in Windows:
1 In Windows, click the Start menu and select Devices and Printers. 2 If you find an Unknown Device under Other Devices or COM Ports,
Driver.
5 In the Update Driver Software - Unknown Device dialog box that
used when you installed support for your Arduino hardware, and then click Next. By default, this folder location is C:\MATLAB\Targets\releasenumber\arduino-version. For example: C:\MATLAB\Targets\R2012a\arduino-1.0.
8 If prompted by Windows Security, choose Install this driver software
anyway, and let Windows complete the process of installing the driver.
9 Try running the model again on your Arduino hardware.
If you get the error message after resolving issues with Arduino drivers, resolve any issues with the COM port settings. The drivers for some Arduino board revisions do not identify the board as an Arduino device in Windows. In that case, set the COM port number manually:
1 Click the Tools menu in the model, and select Run on Target Hardware
> Options.
2 In the Run on Target Hardware pane, change the Set host COM port
1-24
3 Open Devices and Printers in Windows. 4 Double-click Arduino Uno or Arduino Mega 2560 device. 5 In the device properties dialog, click the Hardware tab, and then click the
Properties button.
6 Click the Port Settings tab.
For example, the following image shows an Arduino device in Devices and Printers, the Hardware tab, and the Port Settings tab.
1-25
8 Apply the new Configuration Parameter values, and try running the model
1-26
Description
Get the logical value of a digital pin on the Arduino hardware: If the logical value of the digital pin is LOW, the block outputs 0. If the logical value of the digital pin is HIGH, the block outputs 1. The data type of the block output is uint8. If you simulate your model without running it on the target hardware, this block outputs zeroes. See Block Produces Zeros in Simulation Warning Only connect digital pins to devices that use 5 Volt TTL logic. For details, read the documentation for your Arduino hardware.
-1
Dialog
Pin number Enter the number of the digital pin. Do not assign the same pin number to multiple blocks within the model. For Arduino Mega 2560, enter a pin number from 0 to 53. For Arduino Uno, enter a pin number from 0 to 13.
-2
Sample time Specify how often this block reads the pin value, in seconds. Enter a value greater than zero. This value defaults to a sample time of 1 second. The minimum value is 0.000001 second. Smaller values require the processor to complete the same number of instructions in less time, which can cause task overruns.
Arduino Digital Output | Install Support for Arduino Hardware | Detect and Fix Task Overruns on Arduino Hardware | http://arduino.cc/en/Reference/DigitalRead
-3
Purpose Library
Set logical value of digital output pin Target for Use with Arduino Hardware
Description
Set the logical value of a digital pin on the Arduino hardware: Sending 1 to the block input sets the logical value of the digital pin HIGH to 5 V or 3.3 V, depending on the board voltage. Sending 0 to the block input sets the logical value of the digital pin LOW to 0 V. The block input inherits the data type of the upstream block, and internally converts it to boolean. If you simulate your model without running it on the target hardware, this block does nothing. See Block Produces Zeros in Simulation.
-4
Dialog
Pin number Enter the number of the digital output pin. Do not assign the same pin number to multiple blocks within the model. For Arduino Mega 2560, enter a pin number from 0 to 53. For Arduino Uno, enter a pin number from 0 to 13.
-5
Purpose Library
Measure voltage of analog input pin Target for Use with Arduino Hardware
Description
Measure the voltage of an analog pin relative to the analog input reference voltage on the Arduino hardware. Output the measurement as a 10-bit value that ranges from 0 to 1023. If the measured voltage equals the ground voltage, the block outputs 0. If the measured voltage equals the analog reference voltage, the block outputs 1023. The default value of the analog input reference voltage is 0 to 5 V. To change the Analog input reference voltage parameter in your model Configuration Parameters, select Tools > Run on Target Hardware > Options.... If you simulate your model without running it on the target hardware, this block outputs zeroes. See Block Produces Zeros in Simulation Warning The range of the voltage that can be applied to the analog input pin depends on the analog input reference voltage. For details, read the documentation for your Arduino hardware.
-6
Dialog
Pin number Enter the number of the analog input pin. Do not assign the same pin number to multiple blocks within the model. For Arduino Mega 2560, enter a pin number from 0 to 15. For Arduino Uno, enter a pin number from 0 to 5.
-7
Sample time Specify how often this block reads the pin value. Enter a value greater than zero. This value defaults to a sample time of 1 second. The minimum value is 0.000001 second. Smaller values require the processor to complete the same number of instructions in less time, which can cause task overruns.
See Also
Arduino PWM | Analog input reference voltage | Install Support for Arduino Hardware | Detect and Fix Task Overruns on Arduino Hardware | http://arduino.cc/en/Reference/AnalogRead http://arduino.cc/en/Reference/AnalogReference
External Links
-8
Arduino PWM
Purpose Library
Generate PWM waveform on analog output pin Target for Use with Arduino Hardware
Description
Use pulse-width modulation (PWM) to change the duty-cycle of square-wave pulses output by a PWM pin on the Arduino hardware. PWM enables a digital output to provide a range of different power levels, similar to that of an analog output. The value sent to the block input determines the width of the square wave, called duty-cycle, that the target hardware outputs on the specified PWM pin. The range of valid outputs is 0 to 255. For example: Sending the maximum value, 255, to the block input produces 100% duty-cycle, which results in full power on a PWM pin. Sending the minimum value, 0, to the block input produces 0% duty-cycle, which results in no power on a PWM pin. Sending an intermediate value to the block input produces a proportional duty-cycle and power output on a PWM pin. For example, sending 192 to the block input produces 75% duty cycle and power (192/256 = 0.75). Sending out-of-range values, such as 500 or -500, to the block input has the same effect as sending the maximum or minimum input values. The frequency of the square wave is ~490 Hz. The block input inherits the data type of the upstream block, and internally converts it to uint8.
-9
Arduino PWM
Some limitations: With Arduino Uno hardware, the Arduino PWM block cannot use digital pins 9 or 10 when the model contains Servo blocks. With Arduino Mega 2560 hardware, the Arduino PWM block cannot use digital pins 11 or 12 when the model contains more than 12 Servo blocks.
Dialog
Pin number Enter the number of the PWM pin.
-10
Arduino PWM
Do not assign the same pin number to multiple blocks within the model. For Arduino Mega 2560, enter a pin number from 2 to 13. For Arduino Uno, enter one of the following pin numbers, 3, 5, 6, 9, 10, and 11, which are marked with a ~ symbol.
-11
Purpose Library
Get one byte of data from serial port Target for Use with Arduino Hardware
Description
Get one byte of data per sample period from the receive buffer of the specified serial port. For more information, see Use Serial Communications with Arduino Hardware. The Serial Receive block has two block outputs, Data and Status. When data is available: The Data block output emits data from the serial receive buffer. The Status block output emits 1. When data is not available: The Data block output emits 255. The Status block output emits 0. The datatype of the Data block output is uint8. The datatype of the Status block output is int. You can use the Status block output to determine whether a value of 255 emitted by the Data block output is data, or an indication that no data was received. If you simulate your model without running it on the target hardware, this block outputs zeroes. See Block Produces Zeros in Simulation Do not use this block in models with the Standard Servo Read, Standard Servo Write, and Continuous Servo Write blocks.
-12
Warning Only connect serial port pins to devices that use 5 Volt TTL logic. Do not connect these pins to an RS-232 serial interface, such as the DE-9M connector on a computer, without limiting the voltage. The RS-232 standard allows higher voltages that can damage your hardware. For details, read the documentation for your Arduino hardware.
-13
Dialog
Port Number Enter the number of the serial port. For Arduino Mega 2560, enter 0 - 3. For Arduino Uno, enter 0.
-14
You can assign a Serial Transmit block and a Serial Receive block to the same serial port. Do not assign more than one Serial Receive block to the same serial port. Do not assign the pin numbers used by the serial port to other blocks within the model. Serial port 0 is connected to the USB port through a converter. Do not use both serial port 0 and the USB port at the same time. For example, do not use serial port 0 if you intend to use External mode, because External mode requires the USB port. Sample time Specify how often this block reads the serial port buffer. Enter a value greater than zero. This value defaults to a sample time of 1 second. The minimum value is 0.000001 second. Smaller values require the processor to complete the same number of instructions in less time, which can cause task overruns.
See Also
| Use Serial Communications with Arduino Hardware | Tune and Monitor Models Running on Arduino Mega 2560 Hardware | Detect and Fix Task Overruns on Arduino Hardware | http://arduino.cc/en/Serial/Read
External Links
-15
Purpose Library
Send buffered data to serial port Target for Use with Arduino Hardware
Description
Send buffered data to the specified serial port. For more information, see Use Serial Communications with Arduino Hardware. The Arduino Uno hardware has one serial port device, serial port 0, connected to the digital pins marked TX 1 and RX 0. If you set the Port number parameter to 0, this block transmits over the digital pin marked TX 1. The block input accepts vector or scalar uint8 data. To convert a data source to uint8, use a Data Type Conversion block. If you simulate your model without running it on the target hardware, this block does nothing. See Block Produces Zeros in Simulation. Do not use this block in models with the Standard Servo Read, Standard Servo Write, and Continuous Servo Write blocks. Warning Only connect serial port pins to devices that use 5 Volt TTL logic. Do not connect these pins to an RS-232 serial interface, such as the DE-9M connector on a computer, without limiting the voltage. The RS-232 standard allows higher voltages that can damage your hardware. For details, read the documentation for your Arduino hardware.
-16
Dialog
Port Number Enter the number of the serial port. For Arduino Mega 2560, enter 0 - 3. For Arduino Uno, enter 0. You can assign a Serial Transmit block and a Serial Receive block to the same serial port. Do not assign multiple Serial Transmit blocks to the same serial port. Do not assign the pin numbers used by the serial port to other blocks within the model.
-17
Serial port 0 is connected to the USB port through a converter. Do not use both serial port 0 and the USB port at the same time. For example, do not use serial port 0 if you intend to use External mode, because External mode requires the USB port.
See Also
Use Serial Communications with Arduino Hardware | Tune and Monitor Models Running on Arduino Mega 2560 Hardware |
External Links
http://arduino.cc/en/Serial/Write
-18
Purpose Library
Get position of standard servo motor shaft in degrees Target for Use with Arduino Hardware
Description
Measure the angle of a standard servo motor shaft in degrees, from 0 to 180. The data type of the block output is uint8. If you simulate your model without running it on the target hardware, this block outputs zeroes. See Block Produces Zeros in Simulation. Some limitations: Do not use Servo blocks with External mode or with models that contain Serial Transmit or Serial Receive blocks. The maximum number of Servo blocks per model is 12 for Arduino Uno hardware, and 48 for Arduino Mega 2560 hardware. With Arduino Uno hardware, the Arduino PWM block cannot use digital pins 9 or 10 when the model contains Servo blocks. With Arduino Mega 2560 hardware, the Arduino PWM block cannot use digital pins 11 or 12 when the model contains more than 12 Servo blocks.
-19
Dialog
Pin number Enter the number of the digital pin. Do not assign the same pin number to multiple blocks within the model. For Arduino Mega 2560, enter a pin number from 0 to 53. For Arduino Uno, enter a pin number from 0 to 13.
-20
Sample time Specify how often this block reads the pin value. Enter a value greater than zero. This value defaults to a sample time of 1 seconds. The minimum value is 0.000001 second. Smaller values require the processor to complete the same number of instructions in less time, which can cause task overruns.
See Also
Arduino Standard Servo Write | Arduino Continuous Servo Write | Install Support for Arduino Hardware | Detect and Fix
External Links
http://arduino.cc/en/Reference/ServoRead
-21
Purpose Library
Set shaft position of standard servo motor Target for Use with Arduino Hardware
Description
Set the shaft position of a standard servo motor, from 0 to 180 degrees. To rotate the servo shaft, send values from 0 to 180 to the block input. Sending out-of-range values, such as -5 or 200, to the block input has the same effect as sending the maximum or minimum input values. The block input inherits the data type of the upstream block, and internally converts it to uint8. If you simulate your model without running it on the target hardware, this block does nothing. See Block Produces Zeros in Simulation. Some limitations: Do not use Servo blocks with External mode or with models that contain Serial Transmit or Serial Receive blocks. The maximum number of Servo blocks per model is 12 for Arduino Uno hardware, and 48 for Arduino Mega 2560 hardware. With Arduino Uno hardware, the Arduino PWM block cannot use digital pins 9 or 10 when the model contains Servo blocks. With Arduino Mega 2560 hardware, the Arduino PWM block cannot use digital pins 11 or 12 when the model contains more than 12 Servo blocks.
-22
Dialog
Pin number Enter the number of the digital output pin. Do not assign the same pin number to multiple blocks within the model. For Arduino Mega 2560, enter a pin number from 0 to 53. For Arduino Uno, enter a pin number from 0 to 13.
-23
-24
Purpose Library
Set shaft speed of continuous rotation servo motor Target for Use with Arduino Hardware
Description
Set the direction and speed of a continuous rotation servo motor: Sending -90 to the block input produces the maximum rate of rotation in one direction. Sending 90 to the block input produces the maximum rate of rotation in the opposite direction. Sending 0 to the block input stops the servo motor. Sending out-of-range values, such as -95 or 200, to the block input has the same effect as sending the maximum or minimum input values. The characteristics of some motors cause them to continue rotating when the block input value is 0. In that case, you can experiment to find an offset value that stops the motor. With Arduino Mega 2560 hardware, you can use External mode to determine the offset while your model is running on the hardware. See Tune and Monitor Models Running on Arduino Mega 2560 Hardware. The block input inherits the data type of the upstream block, and internally converts it to uint8. If you simulate your model without running it on the target hardware, this block does nothing. See Block Produces Zeros in Simulation. Some limitations:
-25
Do not use Servo blocks with External mode or with models that contain Serial Transmit or Serial Receive blocks. The maximum number of Servo blocks per model is 12 for Arduino Uno hardware, and 48 for Arduino Mega 2560 hardware. With Arduino Uno hardware, the Arduino PWM block cannot use digital pins 9 or 10 when the model contains Servo blocks. With Arduino Mega 2560 hardware, the Arduino PWM block cannot use digital pins 11 or 12 when the model contains more than 12 Servo blocks.
-26
Dialog
Pin number Enter the number of the digital output pin. Do not assign the same pin number to multiple blocks within the model. For Arduino Mega 2560, enter a pin number from 0 to 53. For Arduino Uno, enter a pin number from 0 to 13.
-27
-28
In this section... Run on Target Hardware Pane Overview on page 1-4 Target hardware on page 1-5 Enable External mode on page 1-7 Enable overrun detection on page 1-8 Digital output to set on overrun on page 1-9 Set host COM port on page 1-10 COM port number on page 1-10
1-2
In this section... Analog input reference voltage on page 1-11 Serial 0 baud rate, Serial 1 baud rate, Serial 2 baud rate, Serial 3 baud rate on page 1-12
1-3
Configuration
1 Choose the Target hardware in the Run on Target Hardware pane. 2 Set the parameters displayed for the selected device type. 3 Apply the changes.
1-4
Target hardware
Select the type of hardware upon which to run your model. Changing this parameter updates the Configuration Parameters dialog so it only displays parameters that are relevant to your target hardware. If your target hardware is supported, but not available in the Target hardware parameter options, use Target Installer to install support for your target hardware. To use Target Installer, close the Configuration Parameters dialog and enter targetinstaller in the MATLAB Command Window. After installing support for your target hardware, reopen the Configuration Parameters dialog and select your target hardware.
Settings
Default: None
None
This setting means your model has not been configured to run on target hardware. Choose your target hardware from the list of options.
Arduino Mega 2560
This setting displays the following configuration parameters for Arduino Mega 2560 hardware: Enable External mode on page 1-7 Enable overrun detection on page 1-8 Digital output to set on overrun on page 1-9 Set host COM port on page 1-10 COM port number on page 1-10 Analog input reference voltage on page 1-11 Serial 0 baud rate, Serial 1 baud rate, Serial 2 baud rate, Serial 3 baud rate on page 1-12
Arduino Uno
This setting displays the following configuration parameters for Arduino Uno hardware: Enable overrun detection on page 1-8
1-5
Digital output to set on overrun on page 1-9 Set host COM port on page 1-10 COM port number on page 1-10 Analog input reference voltage on page 1-11
See Also
Install Support for Arduino Hardware
1-6
Settings
Default: Disabled Disabled The model application does not support External mode. Enabled The model application supports External mode.
See Also
Enable overrun detection on page 1-8 Set host COM port on page 1-10 Tune and Monitor Models Running on Arduino Mega 2560 Hardware Use Serial Communications with Arduino Hardware
1-7
Settings
Default: Disabled Disabled Do not detect overruns. Enabled Detect overruns and generate an error message when an overrun occurs.
See Also
Digital output to set on overrun on page 1-9 Enable External mode on page 1-7 Detect and Fix Task Overruns on Arduino Hardware
1-8
Settings
Default: 13
See Also
Enable overrun detection on page 1-8 Detect and Fix Task Overruns on Arduino Hardware
1-9
Settings
Default: Automatically
Automatically
Let the software determine which COM Port your host computer uses.
Manually
See Also
COM port number on page 1-10
1-10
Settings
Default: 0
See Also
Set host COM port on page 1-10
Settings
Default: Default
Default
Use the default operating voltage of the board. For Arduino Uno and Arduino Mega 2560 the operating voltage is 5 Volts.
Internal (1.1 V)
Valid for Arduino Mega 2560 only: Use the internal 1.1 Volt reference.
Internal (2.56 V)
Valid for Arduino Mega 2560 only: Use the internal 2.56 Volt reference.
External
On the Arduino Uno and Arduino Mega 2560, use an external 0-5 volt power supply connected to the AREF pin. This voltage should match
1-11
the voltage of the power supply connected to the Arduino hardware. If your application requires low-noise measurements, use this option with a filtered power supply.
See Also
Arduino Analog Input
Serial 0 baud rate, Serial 1 baud rate, Serial 2 baud rate, Serial 3 baud rate
Arduino Uno hardware has one serial port, Serial 0. Arduino Mega 2560 hardware has four serial ports, Serial 0 through Serial 3. Set the baud rate of the serial port on the Arduino hardware.
Settings
Default: 9600
300, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, 76800, 115200, 128000, 500000, 1000000
See Also
Arduino Serial Receive Arduino Serial Transmit
1-12