0% found this document useful (0 votes)
22 views1 page

#Pragma #Pragma #Pragma #Pragma #Pragma #Pragma #Pragma #Pragma #Pragma #Pragma #Pragma #Pragma

This document contains configuration settings for sensors and motors used on a robot. It defines sensors for line following, potentiometer, light reflection, touch, bump, encoder, ultrasonic rangefinder, and LED. Motors are defined for a flashlight, right motor, left motor, and servo. It also contains code for a main task that turns a green LED on for 2 seconds if a bump sensor is pressed, and turns it off otherwise, looping for 20 seconds.

Uploaded by

ronald
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
0% found this document useful (0 votes)
22 views1 page

#Pragma #Pragma #Pragma #Pragma #Pragma #Pragma #Pragma #Pragma #Pragma #Pragma #Pragma #Pragma

This document contains configuration settings for sensors and motors used on a robot. It defines sensors for line following, potentiometer, light reflection, touch, bump, encoder, ultrasonic rangefinder, and LED. Motors are defined for a flashlight, right motor, left motor, and servo. It also contains code for a main task that turns a green LED on for 2 seconds if a bump sensor is pressed, and turns it off otherwise, looping for 20 seconds.

Uploaded by

ronald
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
You are on page 1/ 1

File: C:\Users\597406\Documents\try3final.

c
#pragma config(Sensor, in1, linefollower, sensorLineFollower)
#pragma config(Sensor, in2, pot, sensorPotentiometer)
#pragma config(Sensor, in3, light, sensorReflection)
#pragma config(Sensor, dgtl1, limit, sensorTouch)
#pragma config(Sensor, dgtl2, bump, sensorTouch)
#pragma config(Sensor, dgtl3, op, sensorQuadEncoder)
#pragma config(Sensor, dgtl5, ultra, sensorSONAR_inch)
#pragma config(Sensor, dgtl12, greenled, sensorLEDtoVCC)
#pragma config(Motor, port10, flash, tmotorVexFlashlight, ope
#pragma config(Motor, port2, rightmotor, tmotorVex393_MC29, openLo
#pragma config(Motor, port3, leftmotor, tmotorVex393_MC29, openLo
#pragma config(Motor, port9, servo, tmotorServoStandard, open
//*!!Code automatically generated by 'ROBOTC' configuration wizard

/*
Project Title:A3_1_2_Part1
Team Members:Ronald Khong, Darren Lin, Victoria Chen
Date: 2/4/2019
Section:

Task Description:

*/
task main()
{
clearTimer(T1);
while(time1(T1) < 20000) //Loop for 20 sec
{
if(SensorValue(bump)==1) //if bump pressed
{
turnLEDOn(greenled); //the green led turns on
wait(2); //for 2 seconds
}
else(SensorValue(bump)==1); //if bump NOT pressed
{
turnLEDOff(greenled); //the green led turns off
}
}

Page 1 of 1

You might also like