nMotorPIDSpeedCtrl regulates the speed that you set. Normally, a motor will not run perfectly. If you set it to 50, it will try to go 50, but there are instances where the gears have friction, or some other design issue and regulating the motor power will ensure that the robot is going with the motor power level that you set.
This will enable Speed Control for motor C. All you need to do now is to set a power level for motor C. If you would like some tutorials, please go to the robotc.net main site, and go through the Preview for Teaching ROBOTC for Mindstorms. It contains many examples and walk-throughs to show you the basics of how to program and use ROBOTC.
If you want to save data, you can use a variable to store the value.
Variables have types. For example:
int - for integer
float - for numbers containing decimals
string - for a string of characters
boolean - for boolean "true" or "false" values
An example of storing of a value would be this (assuming you went to ROBOT > MOTORS AND SENSORS SETUP to set up your "lightSensor"):
This is a simple program. When run, it takes the current value that the light sensor is reading, then it compares that value to 45. If it's less than 45, it will go forward for 2 seconds. Otherwise, it will run backward for 2 seconds.
Vu NguyenSoftware Training Development Team
Need more support? Use the ROBOTC Ticketing systemRobotc.net
| Robomatter Store
| Robotics Academy