gj08-16 Two Motors Using Improved Delays
XCSB Basic, 15 points
OEES 215
![]() |
Right click here to download the program file from gj03-14. Then modify the program file. Below is a "skeleton" program. Your job is to put some "meat" on it. while 1==1 do //Loop forever ibyt = GetInBts() //Get all the input bits in0 = SelBit(ibyt, 0) //Select input bit 0 and put into in0 //............. if in0 == 1 then //If switch 0 is on, run motors x = Cd1() //Put delay 1 status into x y = Cd2() //Put delay 2 status into 6 if x == 0 && y==0 then //See if both delays have stopped //If both delays have stopped, turn motor 0 on, turn motor 1 off, and wait for a delay of 10 -- You write the part that goes here -- else //If a delay is running, check to see if delay 1 has just finished. //If it has just finished, turn motor 0 off, turn motor 1 on, and wait for a delay of 40 -- You write the part that goes here -- endif endif //............... y = 1000 //Waste time while y > 0 do y = y -1 done Dd1() //Decrement delay 1 Dd2() //Decrement delay 2 Dd3() //Decrement delay 3 Dd4() //Decrement delay 4 done //Go back to the "while" statement |