-
Notifications
You must be signed in to change notification settings - Fork 0
Using the Sensor Struct
This library provides the sensor
structure for VEX sensors which makes monitoring their speed and values much more simple.
Define and initialize a sensor
within your code like the example below:
sensor* sensor_name = initializeSensor(scaling_factor, sensor_port);
The asterisk is necessary, because that designates the sensor as a pointer.
sensor_port
is what port that this sensor is bound to (i.e. in1, dgtl1, I2C_1). scaling_factor
is a float that will be multiplied by the raw sensor value, so if you want to convert the raw value into something more meaningful (i.e. degrees), do that here.
Within any loop where you want to access this sensor's value, call updateSensorValue(sensor_name)
. This structure will not work without this function call. Then, you can access the speed and value of the sensor using sensor_name->speed
and sensor_name->val
, respectively. Value is equal to the raw sensor value times the scaling factor, and speed is in terms of units (as defined by the scaling factor) per second.
Beginner Features:
Intermediate Features:
Advanced Features:
Controlling the LCD
Using Autonomous Modes
Custom Pre Auton Procedure
Using Autonomous Modes in User Control
More Remote Functionality
Configuring Bailout Button
Custom User Control Procedure
PID Control
Drive Train Control