Bumper switch programming
Page 1 of 1

Author:  Robotbuilde1 [ Mon Jan 12, 2015 3:38 pm ]
Post subject:  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;

Author:  mightor [ Thu Jan 15, 2015 3:03 am ]
Post subject:  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

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group