Stepper_Motor() { If message_queue != null { Get speed and duration send information to stepper motor while(time_on < duration) { Run motor_rate = speed if(door_flag = 0) { Stop motor; } } } } Led Display() { DOOR_ERROR = 1 DRUM_ERROR = 2 LINEAR_ERROR = 3 LOW_INSULIN = 4 CHANGE_INSULIN = 5 IF(flag = 10000) { Print to led "DOOR ERROR" } else if(flag = 01000) { print to led "DRUM ERROR" } else if(flag = 00100) { print to led "LINEAR MOTION TABLE ERROR" } else if(flag = 00010) { print to led "LOW INSUlIN" } else if(flag = 00001) { print to led "CHANGE INSULIN BOTTLES" } When first activated print to led "DO YOU WANT A MIXED DOSE" when PUSH_BUTTON is hit then print "DID YOU SAY DIAL_VARIABLE", %f if(DIAL_VARIABLE = yes) { print to led "WHAT DOSE OF CLEAR INSULIN" when PUSH_BUTTON is hit then print "YOU WANT DIAL_VARIABLE UNITS OF CLEAR", %f print to led "WHAT DOSE OF CLOUDY INSULIN" when PUSH_BUTTON is hit then print "YOU WANT DIAL_VARIABLE UNITS OF CLOUDY", %f } ELSE { print to led "WHAT DOSE OF CLEAR INSULIN" when PUSH_BUTTON is hit then print "YOU WANT DIAL_VARIABLE UNITS OF CLEAR", %f } when process complete print to led "COMPLETED PLEASE REMOVE SYRINGE" } BOTTLE DRUM() { If message_queue != null { Get speed and duration send information to bottle drum while(time_on < duration) { Run motor_rate = speed if(door_flag = 0) { Stop motor; } } make sure drum is aligned with sensor. } } SYRINGE_TO_BOTTLE() { If message_queue != null { Get speed and duration send information to motor while(time_on < duration) { Run motor_rate = speed if(door_flag = 0) { Stop motor; } } } } INTERFACE() { if(DEVICE_SLEEP = high) { if(BUTTON_VAIABLE = high) { wake up device } else { stay sleeping } } if(DEVICE_SLEEP = low) { if(BUTTON_VAIABLE = high) { send message to main() } else { wait 5 min and if BUTTON_VALUE not high sleep } } } Led Display() { DOOR_ERROR = 1 DRUM_ERROR = 2 LINEAR_ERROR = 3 LOW_INSULIN = 4 CHANGE_INSULIN = 5 IF(flag = 10000) { say "DOOR ERROR" } else if(flag = 01000) { say "DRUM ERROR" } else if(flag = 00100) { say "LINEAR MOTION TABLE ERROR" } else if(flag = 00010) { say "LOW INSUlIN" } else if(flag = 00001) { say "CHANGE INSULIN BOTTLES" } When first activated say "DO YOu WANT A MIXED DOSE" when PUSH_BUTTON is hit then say "DID YOU SAY DIAL_VARIABLE", %f if(DIAL_VARIABLE = yes) { say "WHAT DOSE OF CLEAR INSULIN" when PUSH_BUTTON is hit then print "YOU WANT DIAL_VARIABLE UNITS OF CLEAR", %f while DIAL IS IN MOTION { say "UNIT_VALUE" every sec } say "WHAT DOSE OF CLOUDY INSULIN" when PUSH_BUTTON is hit then print "YOU WANT DIAL_VARIABLE UNITS OF CLOUDY", %f } ELSE { say "WHAT DOSE OF CLEAR INSULIN" when PUSH_BUTTON is hit then say "YOU WANT DIAL_VARIABLE UNITS OF CLEAR", %f while DIAL IS IN MOTION { say "UNIT_VALUE" every sec } } when process complete say "COMPLETED PLEASE REMOVE SYRINGE" } DEBUGTX() { If message_queue != null { Get message send information to rs232 i = 0; while(sting != null) { set pointer to string print to screen POINTER = *i } } }