Skip to content

Instantly share code, notes, and snippets.

Created March 26, 2013 20:43
Show Gist options
  • Save anonymous/5249060 to your computer and use it in GitHub Desktop.
Save anonymous/5249060 to your computer and use it in GitHub Desktop.
Controlling motors using Sensors (Robotc)
#pragma config(Sensor, in1, lineFollower, sensorLineFollower)
#pragma config(Sensor, in2, potentiometer, sensorPotentiometer)
#pragma config(Sensor, in3, lightSensor, sensorReflection)
#pragma config(Sensor, dgtl1, limitSwitch, sensorTouch)
#pragma config(Sensor, dgtl2, bumpSwitch, sensorTouch)
#pragma config(Sensor, dgtl3, quad, sensorQuadEncoder)
#pragma config(Sensor, dgtl5, sonar, sensorSONAR_inch)
#pragma config(Sensor, dgtl12, green, sensorDigitalOut)
#pragma config(Motor, port2, rightMotor, tmotorVex269, openLoop)
#pragma config(Motor, port3, leftMotor, tmotorVex269, openLoop)
#pragma config(Motor, port9, ServoMotor, tmotorServoStandard, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
/*
Project Title: Activit 1.2.4 Basic Inputs Programming Part1
Team Members: Wilfied Hounyo
Date:11-19-12
Section:TBA
Task Description: Controlling motors using Sensors
Pseudocode:
untilBump(bumpSwitch);
startMotor(rightMotor, 67);
wait(5);
stopMotor(rightMotor);
*/
task main()
{ //Program begins, insert code within curly braces
//start task
untilBump(bumpSwitch); //Wait for bumper to be pressed
startMotor(rightMotor, 67); //when pressed turn right motor at speed 67
wait(5); //turn right motor for 5 seconds
stopMotor(rightMotor); //then stop right motor
//end task
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment