View unanswered posts | View active topics It is currently Wed Aug 12, 2020 3:39 am

Reply to topic  [ 2 posts ] 
Bumper switch programming 
Author Message

Joined: Mon Jan 12, 2015 3:31 pm
Posts: 1
Post Bumper switch programming
i cannot figure out how to start bumper sensors on their own. There are no motors attached. I need to be able to press one bumper switch and have the timer start running, and I need the timer to stop when I press the bumper switch again. I need this as soon as possible. your help is appreciated.

#pragma config(I2C_Usage, I2C1, i2cSensors)
#pragma config(Sensor, in1,    Bumper1,        sensorAnalog)
#pragma config(Sensor, in2,    Bumper2,        sensorAnalog)
#pragma config(Sensor, I2C_1,  ,               sensorQuadEncoderOnI2CPort,    , AutoAssign)

//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

short valTime1;
short varPgmTime;

//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//
   //until the 'Bumpersensor1' is pressed
if (condition) statement;

valTime1 = time1[T1]; //Gets the value of Timer T1 in 1ms increments and stores it in a variable

   //until the 'Bumpersensor2' is pressed

   // Stores the current value of nPgmTime to a variable

   varPgmTime = nPgmTime;

Mon Jan 12, 2015 3:38 pm
Site Admin
Site Admin
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Post Re: Bumper switch programming
Could you please post the entire program and not just a snippet? I have enclosed your code in

for readability, please use these when posting code.

= Xander

| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]

Thu Jan 15, 2015 3:03 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.