ARDUINO MEGA Functions Sensors
From ROBOTC API Guide
(→Information) |
|||
| (9 intermediate revisions by one user not shown) | |||
| Line 1: | Line 1: | ||
| − | <yambe:breadcrumb>ARDUINO_MEGA_Functions_and_Variables|Functions and Variables</yambe:breadcrumb> | + | {{DISPLAYTITLE:2560 (MEGA) Sensor Functions}} |
| + | <yambe:breadcrumb self="2560 (MEGA) Sensor Functions">ARDUINO_MEGA_Functions_and_Variables|Functions and Variables</yambe:breadcrumb> | ||
<br /> | <br /> | ||
| Line 8: | Line 9: | ||
The Arduino MEGA has 16 analog sensor ports and 53 digital sensor ports. | The Arduino MEGA has 16 analog sensor ports and 53 digital sensor ports. | ||
| − | === Analog: === | + | === Analog === |
| − | '''No Sensor''' - No Sensor Attached. Pin is disabled. | + | {|style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:center; font-size:100%; border-collapse: separate; border-spacing: 0; border-width: 1px; border-style: solid; border-color: #000;" cellpadding="5%" |
| − | + | ! style="background-color:#E3E3E3; text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|Sensor Type: | |
| − | '''Analog''' - Standard Analog Input (0-1023), no modification to raw value. | + | ! style="background-color:#E3E3E3; text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|Comments: |
| − | + | |- | |
| − | '''Potentiometer''' - Standard Analog Input (0-1023), no modification to raw value. | + | | style="text-align:left; border-style: solid; border-width: 1px 0px 1px 0px"|'''No Sensor''' |
| − | + | | style="text-align:left; border-style: solid; border-width: 1px 0px 1px 0px"|No Sensor Attached. Pin is disabled. | |
| − | '''Light Sensor''' - Standard Analog Input (0-1023), no modification to raw value. | + | |- |
| − | + | |style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|'''Analog''' | |
| − | '''Line Follower''' - Standard Analog Input (0-1023), no modification to raw value. | + | |style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|Standard Analog Input (0-1023), no modification to raw value. |
| − | + | |- | |
| − | '''Gyro Sensor''' - Support for VEX Gyro Sensor. See documentation here. | + | |style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|'''Potentiometer''' |
| − | + | |style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|Standard Analog Input (0-1023), no modification to raw value. | |
| − | '''Accelerometer''' - Support for VEX Accelerometer. See documentation here. | + | |- |
| − | + | |style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|'''Light Sensor''' | |
| − | '''Digital In''' - Use an analog pin as a digital input (not currently supported) | + | |style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|Standard Analog Input (0-1023), no modification to raw value. |
| − | + | |- | |
| − | '''Digital Out''' - Use an analog pin as a digital output (not currently supported) | + | |style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|'''Line Follower''' |
| + | |style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|Standard Analog Input (0-1023), no modification to raw value. | ||
| + | |- | ||
| + | |style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|'''Gyro Sensor''' | ||
| + | |style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|Support for VEX Gyro Sensor. See documentation here. | ||
| + | |- | ||
| + | |style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|'''Accelerometer''' | ||
| + | |style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|Support for VEX Accelerometer. See documentation here. | ||
| + | |- | ||
| + | |style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|'''Digital In''' | ||
| + | |style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|Use an analog pin as a digital input (not currently supported) | ||
| + | |- | ||
| + | |style="text-align:left; border-style: solid; border-width: 0px 0px 0px 0px"|'''Digital Out''' | ||
| + | |style="text-align:left; border-style: solid; border-width: 0px 0px 0px 0px"|Use an analog pin as a digital output (not currently supported) | ||
| + | |} | ||
<br /> | <br /> | ||
| − | === Digital: === | + | === Digital === |
| − | '''No Sensor''' - No Sensor Attached. Pin is disabled. | + | {|style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:center; font-size:100%; border-collapse: separate; border-spacing: 0; border-width: 1px; border-style: solid; border-color: #000;" cellpadding="5%" |
| − | + | !style="background-color: #E3E3E3;text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|Sensor Type: | |
| − | '''Touch''' - Digital Input for touch sensors. (reversed from "Digital In" command) | + | !style="background-color: #E3E3E3;text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|Comments: |
| − | + | |- | |
| − | '''Quadrature Encoder (Two Pins)''' - Support for VEX Quadrature Encoder. See documentation here. | + | |style="text-align:left; border-style: solid; border-width: 1px 0px 1px 0px"|'''No Sensor''' |
| − | + | |style="text-align:left; border-style: solid; border-width: 1px 0px 1px 0px"|No Sensor Attached. Pin is disabled. | |
| − | '''LED to Vcc''' - Pin configured as digital output with reversed logic (for LEDs) (0 = LED on, 1 = LED off) | + | |- |
| − | + | |style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|'''Touch''' | |
| − | '''Digital In''' - Pin configured as digital input with internal "Pull-Up" resistor enabled. | + | |style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|Digital Input for touch sensors. (reversed from "Digital In" command) |
| − | + | |- | |
| − | '''Digital Out''' - Pin configured as digital output. | + | |style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|'''Quadrature Encoder (Two Pins)''' |
| − | + | |style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|Support for VEX Quadrature Encoder. See documentation here. | |
| − | '''Digital High Inpedance''' - Pin configured as digital input without the "Pull-Up" resistor enabled. | + | |- |
| − | + | |style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|'''LED to Vcc''' | |
| − | '''Sonar [Ping]''' - Support for Parallax Ping Sonar Sensor (returns distance in cm, mm, inches, raw) | + | |style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|Pin configured as digital output with reversed logic (for LEDs) (0 = LED on, 1 = LED off) |
| − | + | |- | |
| − | '''Sonar [SRP-04] (Two Pins)''' - Support for VEX Robotics Sonar Sensor (returns distance in cm, mm, inches, raw) | + | |style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|'''Digital In''' |
| − | <br /> | + | |style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|Pin configured as digital input with internal "Pull-Up" resistor enabled. |
| + | |- | ||
| + | |style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|'''Digital Out''' | ||
| + | |style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|Pin configured as digital output. | ||
| + | |- | ||
| + | |style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|'''Digital High Inpedance''' | ||
| + | |style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|Pin configured as digital input without the "Pull-Up" resistor enabled. | ||
| + | |- | ||
| + | |style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|'''Sonar [Ping]''' | ||
| + | |style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|Support for Parallax Ping Sonar Sensor (returns distance in cm, mm, inches, raw) | ||
| + | |- | ||
| + | |style="text-align:left; border-style: solid; border-width: 0px 0px 0px 0px"|'''Sonar [SRP-04] (Two Pins)''' | ||
| + | |style="text-align:left; border-style: solid; border-width: 0px 0px 0px 0px"|Support for VEX Robotics Sonar Sensor (returns distance in cm, mm, inches, raw) | ||
| + | |} | ||
| + | <br /><br /> | ||
== SensorType == | == SensorType == | ||
Latest revision as of 13:44, 11 May 2012
ARDUINO → Functions and Variables → 2560 (MEGA) Sensor Functions
|
| |||||||
Information
The Arduino MEGA has 16 analog sensor ports and 53 digital sensor ports.
Analog
| Sensor Type: | Comments: |
|---|---|
| No Sensor | No Sensor Attached. Pin is disabled. |
| Analog | Standard Analog Input (0-1023), no modification to raw value. |
| Potentiometer | Standard Analog Input (0-1023), no modification to raw value. |
| Light Sensor | Standard Analog Input (0-1023), no modification to raw value. |
| Line Follower | Standard Analog Input (0-1023), no modification to raw value. |
| Gyro Sensor | Support for VEX Gyro Sensor. See documentation here. |
| Accelerometer | Support for VEX Accelerometer. See documentation here. |
| Digital In | Use an analog pin as a digital input (not currently supported) |
| Digital Out | Use an analog pin as a digital output (not currently supported) |
Digital
| Sensor Type: | Comments: |
|---|---|
| No Sensor | No Sensor Attached. Pin is disabled. |
| Touch | Digital Input for touch sensors. (reversed from "Digital In" command) |
| Quadrature Encoder (Two Pins) | Support for VEX Quadrature Encoder. See documentation here. |
| LED to Vcc | Pin configured as digital output with reversed logic (for LEDs) (0 = LED on, 1 = LED off) |
| Digital In | Pin configured as digital input with internal "Pull-Up" resistor enabled. |
| Digital Out | Pin configured as digital output. |
| Digital High Inpedance | Pin configured as digital input without the "Pull-Up" resistor enabled. |
| Sonar [Ping] | Support for Parallax Ping Sonar Sensor (returns distance in cm, mm, inches, raw) |
| Sonar [SRP-04] (Two Pins) | Support for VEX Robotics Sonar Sensor (returns distance in cm, mm, inches, raw) |
SensorType
| TSensorTypes SensorType[tSensors sensor] | |||||||
| (TSensorTypes) The SensorType array is used to manually specify what type of sensor is connected to a specific pin. Most users should not have to use this functionality and should use the Motors and Sensor Setup instead.
|
SensorValue
| word SensorValue[tSensors sensor] | |||||||||||
| (word) This array value will return and modify the value of the sensor. When a pin is set as an "input" the SensorValue array command will return the value from the sensor attached to that pin. When a pin is set as an "output", the SensorValue array can be written to set the output value of the pin (typically Digital Outs will be set to 0 for Low and 1 for High).
|