Information
| The Arduino MEGA has 16 analog sensor ports and 53 digital sensor ports.
|
SensorType
| TSensorTypes SensorType[tSensors sensor]
|
| (TSensorTypes) The SensorType array is used to specify what type of sensor is connected to a certain port. Most users should not have to use this functionality and should use the Motors and Sensor Setup instead.
| Parameter
|
Explanation
|
Data Type
|
| sensor
|
A sensor port or name
|
tSensors
|
SensorType[sonarSensor] = sensorSonar; // set 'SonarSensor' to be of type sensorSonar (the Motors and
// sensors Setup screen does this for you in the background)
|
|
SensorValue
| word SensorValue[tSensors sensor]
|
| (word) This array value returns the value of the sensor in a normalized fashion. Rather than returning a raw value of 0 to 1023, ROBOTC will interpret the data from the "SensorType" and return a more accurate representation of the sensor's data. An example of this is the Light Sensor, which will return a percentage value from 0 to 100.
| Parameter
|
Explanation
|
Data Type
|
| sensor
|
A sensor port or name
|
tSensors
|
while(SensorValue(touchSensor) == 0) //Loop while robot's bumper/touch sensor isn't 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
}
|
|