ROBOTC for Arduino - Motors and Sensors Setup  

The Motor and Sensor Setup window is one of the key features of ROBOTC. This screen is where you can configure all of the inputs and outputs attached to your robot controller. All configurations created in the Motors and Sensors setup screen will only remain persistant for that individual program. Configurations are saved with the program, though, so you will not have to reconfigure the Motors and Sensor Setup every time you open that program.

To open the Motors and Sensor Setup screen, click the Robot menu and then select "Motors and Sensor Setup."

 

Std Configurations Tab:

 

In this menu, a user can select a preconfigured model for use. This will set up the motors and sensors automatically to match the preconfigured robot model. You may also select how much freedom a user has in customizing the preconfigured robot models. There are no preconfigured models for the Arduino, yet.


Controller Board:

In this menu, users can select which Arduino board they would like to program for. There is also a set of three drop-down menus for optional shields that may be attached to the Arduino.


Motors Tab:
The "Motors" tab is used to configure the outputs on your controller, as well as assign aliases to the motors to make your program more readable. The amount of motor pins and the types of motors that are able to be connected to them varies with the different Arduino boards. There are three parts to the motors page:

 

Port
The port index will tell you which port setting you are currently modifying. motorA = a motor plugged into Port A. 
 

Name
The text box for the "name" field allows you to create an alias for that specific motor port. In the example above, both motor[motorA] and motor[left_motor] would access the same motor.

Type
The type drop down box is used set the type of motor you want to use. There are four options:

  • No Motor/No Servo (default) - This will assign no special behavior to the motor port selected and will not generated any code.
  • Servo - Standard - This sets the pin as the signal pin for a basic servo.
  • Servo - Cont. Rotation - This sets the pin as the signal pin for a continuous rotation servo .
  • Ext HBridge - Single PWM - This sets the pin as the signal pin for an external H-bridge controller.
  • Ext. HBridge - Dual PWM - This sets the pin as the first signal pin for an exteranl H-bridge controller. The drop down menu that appears under "Secondary" allows you to choose which pin is the second signal pin.
  • Variable Intensity LED - This sets the pin as a LED brightness control pin.
  • Analog Write - This sets the pin as an analog write pin (0 to +5 volts).



Analog/Digital Tab:
The Analog and Digital tabs are used to configure specific pins as analog or digital inputs and outputs. ROBOTC will take care of most of the background tasks for using sensors (such as calibration/scaling for light sensors and creating a counter for rotation sensors), so it is highly advisable to use the sensors portion of the Motors and Sensor Setup screen. These tabs vary depending on which specific Arduino board is being used.



Index
The index will tell you which port's settings you are currently modifying. S1 = Sensor Port 1.

Name
The text box for the "name" field allows you to create an alias for that specific sensor port. In this example, both SensorValue[in1] and SensorValue[touch1] would access the same sensor.

Type
The type drop down box is used set the type of Sensor you want to use. There are multiple options:

Analog:

  • No Sensor (default) - This will assign no special behavior to the sensor port selected and will not generated any code.
  • Analog - This will set the pin as an analog (0 to 1023) pin. 
  • Potentiometer - This will set the pin as an analog (0 to 1023) input pin, for use with potentiometers. 
  • Light Sensor - This will set the pin as an analog (0 to 1023) pin to be used with light sensors. 
  • Line Follower - This will set the pin as an analog (0 to 1023) pin to be used with line follower sensors.
  • Gyro - This sets the pin as a signal pin for a VEX Gyroscope Sensor.
  • Accelerometer - This sets the pin as a signal pin for a VEX Accelerometer Sensor.
  • Digital In - This sets the pin as a digital (0 or +5 volts) input pin.
  • Digital Out - This sets the pin as a digital (0 or +5 volts) output pin.

Digital:

  • No Sensor (default) - This will assign no special behavior to the sensor port selected and will not generated any code.
  • Touch - This will set the pin as a Digital Input for touch sensors (reversed from Digital In).
  • Compass - This will set the pin as the signal pin for a digital compass module.
  • Quadrature Encoder - This will set the pin and the next pin higher than it as signal pins for a VEX Quadrature Encoder.
  • LED to Vcc - This will set the pin as a digital output pin with reversed logic.
  • Digital In - This will set the pin as a digital input with internal "pull-up" resistor enabled.
  • Digital Out - This will set the pin as a digital output pin.
  • Digital High Impedance - This will set the pin as a digital input with internal "pull-up" resistor disabled.
  • Sonar [Ping] - This sets the pin as the signal pin for a Parallax Ping Sonar Sensor.
  • Sonar [SRP-04] - This sets the pin as the signal pin for a VEX Sonar Sensor.


Copyright © 2012 Robotics Academy/Robomatter - http://robotc.net/