-
Notifications
You must be signed in to change notification settings - Fork 0
Defining Hardware
johnmeshulam edited this page Nov 10, 2019
·
5 revisions
Hardware is defined inside the init() method of the HardwareCreator class.
To define new motors: use new <MotorType>(String name, char port);
Example: new LargeMotor("myMotor", 'A');
If you motor is inverted, add true to the end of the constructor: new LargeMotor("myMotor", 'A', true)
Available motor types: LargeMotor, MediumMotor.
To define new sensors: use new <SensorType>(String name, int port);
Example: new GyroSensor("myGyro", 2);
Available sensor types: GyroSensor, TouchSensor, ColorSensor, UltrasonicSensor
To define a RobotChassis, use: new RobotChassis(String leftMotorName, char leftMotorPort, String rightMotorName, char rightMotorPort, boolean isInverted);
(There are a few constructors, in case some parameters are not specified)
public class HardwareCreator {
public static void init() {
new RobotChassis("leftMotor", 'B', "rightMotor", 'C');
new MediumMotor("armMotor", 'A');
new GyroSensor("gyro", 1);
new TouchSensor("touch", 2);
}
}- Overview
- Code Documentation
- Writing our first run
- Setting Up
- Defining hardware
- Writing a basic Motor Control run
- [Adding sensors and waits]
- [Defining Runs]
- Writing our second run
- [Using the chassis]
- [Finishing up]
- [Line follower code example]