code examples for engineering

code examples for engineering - Off(LEFT On(RIGHT else...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 // sensors, motors and times #define BUMP SENSOR_1 #define EYE1 SENSOR_2 #define EYE2 SENSOR_3 #define LEFT OUT_A #define RIGHT OUT_C #define MOVE_TIME 100 #define TURN_TIME 85 //variables int Black = (35) int White = (46) int Green = (43) task main() { SetSensor(EYE1, SENSOR_LIGHT) SetSensor(EYE2, SENSOR_LIGHT) SetSensor(BUMP, SENSOR_TOUCH) OnFwd(LEFT+RIGHT) while(true) {
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: { Off(LEFT) On(RIGHT) } else if(EYE2 >Green)&&(EYE2 <Black)) { Off(RIGHT) On(LEFT) } else if((EYE1 <Green)&&(EYE2 <Green)) { OnFwd(LEFT+RIGHT) Wait(MOVE_TIME) OnRev(RIGHT) Wait(TURN_TIME) On(LEFT+RIGHT) } else { OnFwd(LEFT+RIGHT) until(BUMP==1) OnRev(LEFT+RIGHT) until(EYE1==Green)&&(EYE2==Green) } } Sheet1 Page 2 }...
View Full Document

This note was uploaded on 09/06/2011 for the course EGN 1500 taught by Professor Staff during the Fall '10 term at Wayne State University.

Page1 / 2

code examples for engineering - Off(LEFT On(RIGHT else...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online