'Dennis's caster program 1.0 'This program should make a caster wheel go in and out of the bot '-------------------Constants---------------------------------------------- 'Global ON con 1 'These are Global constants that I use to tell if the sensor is activated or not. OFF con 0 MOTOR_STOP con 127 'Sets the motor to idle. 'Local C_CAST_SWITCH_UP con 1 'These are the constants that I use to say the difference between the two switch position on the caster. C_CAST_SWITCH_DOWN con 0 C_CAST_REV con 30 'Sets the motor to reverse. C_CAST_FWD con 225 'Sets the motor to forward. '------------------Inputs and Outputs----------------------------------------------- 'Inputs inp_cast_tog_switch var bit 'This part stores if the switch is up or down (port2 pin2 ). inp_cast_sensor_up var bit 'This part stores if the sensor up is on (digital 15 ). inp_cast_sensor_down var bit 'This part stores if the sensor down is on (digital 18 ). 'Outputs out_cast var byte 'This part stores what the motor does (pwm 7). '-------------------------Grabber Main Program----------------------------------------------------- caster_main: if (inp_cast_tog_switch = C_CAST_SWITCH_UP) then caster_up 'This part checks if the switch is up or down. if (inp_cast_sensor_down = OFF) then caster_move_down 'This part checks if sensor down senses anything. out_cast = MOTOR_STOP 'This part stops the motor. return 'This returns to the Main program. caster_up: if (inp_cast_sensor_up = OFF) then caster_move_up 'This part checks if sensor up senses anything. out_cast = MOTOR_STOP return caster_move_up: out_cast = C_CAST_REV 'This part runs the motor reverse return caster_move_down: out_cast = C_CAST_FWD 'This part runs the motor forward return 'This program makes the Reader cry. The good kind of crying (Times 2).