13.07.2015 Views

Presentation Slides - Mechatronics

Presentation Slides - Mechatronics

Presentation Slides - Mechatronics

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Program LogicUsing PBasic commands and routines, the car’s motion throughthe photogates was detected and timed. The velocity wass thencalculated and displayed.The data was also sent to a subroutinethat compared the speed of the car to a selected speed limit. Ifthe speed was above the limit the servo motor then changed theposition of the potentiometer to lower the speed.Start: ' Check Gate 1 for carLOOP :Gate1:Detect1 = IN5IF Detect1 = 0 THEN Count1 'WAITS FOR CAR TO ENTER GATE 1PAUSE 20GOTO LOOP'Timing loopCOUNT1: ' TIME BETWEEN GATES 1 AND 2FOR y = 1 TO 65000 ' COUNTS TIME BETWEEN GATESDetect2 = IN8IF Detect2 = 0 THEN Count2PAUSE 10y= y+1NEXTCalcSpeed: ' Calculates the speed using the “modulus”Command to get three decimal places.vel = 19*145/yr4 = 19*145//yv2 = 10*r3/yvel2 = 19* 145/br5 = 19*145//bv22 = 10*r5/bvel3 = 16* 145/cr6 = 16*145//cv32 = 10*r6/c

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!