|
|
| Line 7: |
Line 7: |
| | |- | | |- |
| | |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. |
| − | |-
| |
| − | |}
| |
| − | <br />
| |
| − |
| |
| − | == SensorBoolean ==
| |
| − | {| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0"
| |
| − | |-
| |
| − | | class="functionType"| <span class="bigKeywordBI">const word </span><span class="bigKeywordB">SensorBoolean</span><span class="bigCodePunc">[</span><span class="bigCodeBasic">tSensors sensor</span><span class="bigCodePunc">]</span>
| |
| − | |-
| |
| − | | style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:left; font-size:100%;"|([[Data_Types#dataType_word|word]]) This returns a true or false reading from the sensor. (Mostly used by Touch sensors).
| |
| − |
| |
| − |
| |
| − | {| class="parameterTable" cellpadding="5%" width="100%"
| |
| − | ! width="20%" style="border-style: solid; border-width: 0px 0px 1px 0px"|Parameter
| |
| − | ! width="60%" style="border-style: solid; border-width: 0px 0px 1px 0px"|Explanation
| |
| − | ! width="20%" style="border-style: solid; border-width: 0px 0px 1px 0px"|Data Type
| |
| − | |-
| |
| − | | style="border-style: solid; border-width: 1px 0px 0px 0px"|''sensor''
| |
| − | | style="border-style: solid; border-width: 1px 0px 0px 0px"|A sensor port or name
| |
| − | | style="border-style: solid; border-width: 1px 0px 0px 0px"|[[Data_Types#dataType_tSensors|tSensors]]
| |
| − | |-
| |
| − | |}
| |
| − |
| |
| − |
| |
| − | {|
| |
| − | |-
| |
| − | |<syntaxhighlight lang="robotc">
| |
| − | while(SensorBoolean[touchSensor]) // Loop while robot's bumper/touch sensor is pressed in
| |
| − | {
| |
| − | motor[rightMotor] = 63; // Right motor is run at half (63) power forward
| |
| − | motor[leftMotor] = 63; // Left motor is run at half (63) power forward
| |
| − | }
| |
| − | </syntaxhighlight>
| |
| − | |-
| |
| − | |}
| |
| − | |-
| |
| − | |}
| |
| − | <br />
| |
| − |
| |
| − | == SensorRaw ==
| |
| − | {| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0"
| |
| − | |-
| |
| − | | class="functionType"| <span class="bigKeywordBI">word </span><span class="bigKeywordB">SensorRaw</span><span class="bigCodePunc">[</span><span class="bigCodeBasic">tSensors sensor</span><span class="bigCodePunc">]</span>
| |
| − | |-
| |
| − | | style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:left; font-size:100%;"|([[Data_Types#dataType_word|word]]) This array value will return the "raw" (un-normalized) value of a sensor. Usually this is the raw A-D converted value, which is an analog value between 0 to 1023.
| |
| − |
| |
| − |
| |
| − | {| class="parameterTable" cellpadding="5%" width="100%"
| |
| − | ! width="20%" style="border-style: solid; border-width: 0px 0px 1px 0px"|Parameter
| |
| − | ! width="60%" style="border-style: solid; border-width: 0px 0px 1px 0px"|Explanation
| |
| − | ! width="20%" style="border-style: solid; border-width: 0px 0px 1px 0px"|Data Type
| |
| − | |-
| |
| − | | style="border-style: solid; border-width: 1px 0px 0px 0px"|''sensor''
| |
| − | | style="border-style: solid; border-width: 1px 0px 0px 0px"|A sensor port or name
| |
| − | | style="border-style: solid; border-width: 1px 0px 0px 0px"|[[Data_Types#dataType_tSensors|tSensors]]
| |
| − | |-
| |
| − | |}
| |
| − |
| |
| − |
| |
| − | {|
| |
| − | |-
| |
| − | |<syntaxhighlight lang="robotc">
| |
| − | if(SensorRaw[lightSensor] > 512) // If the Raw Value of the Light Sensor is greater than 512:
| |
| − | {
| |
| − | motor[rightMotor] = 63; // Right motor is run at half (63) power forward
| |
| − | motor[leftMotor] = 63; // Left motor is run at half (63) power forward
| |
| − | }
| |
| − | </syntaxhighlight>
| |
| − | |-
| |
| − | |}
| |
| | |- | | |- |
| | |} | | |} |
| The Arduino MEGA has 16 analog sensor ports and 53 digital sensor ports.
|