# Sensors

Read (R) and Write (W) values that come from the robot's sensors. For example, "if accelerometer z-axis > 3G, then set LED's to green."

## Read (R) and Write (W)

Read and Write Sensors can be read to evaluate in conditions, but also written as an outcome of a condition. Notice the RW sensors each have a corresponding W only block in the Actions category: Set Heading, Set Speed and Set Color. The Action blocks make it easy for a beginner to write a program quickly by just setting values for each sensor. While the Oval code for the Action-type and Sensor-type is the same, the Sensor-based versions enable embedding the values so they can be read and used in more complex conditions.

// type: float // access: read & write // range: 0 - 360 // units: degrees controlSystemTargetYaw is the directional angle of the robot. Assuming you aim the robot with the blue tail light facing you, then 0° heading is forward, 90° is right, 270° is left, and 180° is back.

### Speed

// type: float // access: read & write // range: 0 - 255 // units: none

controlSystemTargetSpeed is how fast the robot rolls, on a scale from 0 to 255.

### Color

// type: float // access: read & write // range: 0 - 255 // units: none

Individual color channels of the main LED lights, from 0 - 255:

redLed is the red channel, from 0 - 255.

greenLed is the green channel, from 0 - 255.

blueLed is the blue channel, from 0 - 255.

Read Only Sensors can only be "read" to evaluate in conditions; they can't write. Take a simple thermometer for example; you can't "set" a thermometer, you can only read the temperature value.

### Gyroscope

// type: float // access: read // range: -2,000 - 2,000 // units: degrees per second

The spin rate of rotation around a given axis, from -2,000° to 2,000° per second.

gyroSensorPitch is the rate of forward or backward spin, from -2,000° to 2,000° per second.

gyroSensorRoll is the rate of left or right spin, from -2,000° to 2,000° per second.

gyroSensorYaw is the rate of sideways spin, from -2,000° to 2,000° per second.

### Orientation

// type: float // access: read // range: -180 - 180 // units: degrees

The tilt angle along a given axis measured by the Gyroscope.

imuPitchAngle is the forward or backward tilt angle, from -180° to 180°.

imuRollAngle is left or right tilt angle, from -90° to 90°.

imuYawAngle is the spin angle, from -180° to 180°.

### Accelerometer

// type: float // access: read // range: -8 - 14 // units: G's

Motion acceleration along a given axis.

accelSensorXRight is the left-to-right acceleration, on a scale of -8 to 8 G's.

accelSensorYForward is the forward-to-back acceleration, on a scale of -8 to 8 G's.

accelSensorZUp is the up-and-down acceleration, on a scale of -8 to 8 G's.

(((accelSensorXRight^2)+(accelSensorYForward^2)+(accelSensorZUp^2))^0.5) is the combined vector acceleration of all 3 axes, on a scale of 0 to 14 G's.

### Vertical Acceleration

// type: float // access: read // range: -8 - 8 // units: G's

verticalAcceleration is the up-and-down acceleration regardless of the robot's orientation, on a scale of -8 to 8 G's.

### Velocity

// type: float // access: read // range: any // units: meters per second

Estimated velocity along a given axis measured by the encoders, in meters per second.

locatorVelocityX is the left (-) or right (+) speed, in meters per second.

locatorVelocityY is the forward (+) or back (-) speed, in meters per second.

(((locatorVelocityX^2)+(locatorvelocityY^2))^0.5) is the combined vector speed of both axes which will always be a positive value, in meters per second.

### Location

// type: float // access: read // range: any // units: meters

Estimated location from the origin of a program measured by the encoders, in meters.

locatorPositionX is the left or right location in context to the origin, in meters.

locatorPositionY is the forward or back location in context to the origin, in meters.

### Temperature

// type: float // access: read // range: any // units: degrees celsius

getTemperature is the temperature inside the robot in °Celsius (C), which can be significantly different than your room temperature because the robot heats up while driving and charging, and can take a while to cool down.