Tuesday, 23 March 2010

Case Statements

The following flowchart code is being considered; utilising case statements to direct the robot:

Let b0 = pins
let b1 = 000111 & pins
select b1
case = 000000; both motors off and return to select
case = 000001; Right hand motor on and return to select
case = 000010; both motors on and return to select
case = 000011; Right hand motor on and return to select
case = 000100; Left hand motor on and return to select
case = 000101; Error
case = 000110; Left hand motor on and return to select
case = 000111; both motors on and return to select


The individual case (ie how to drive both motors will be developed in a later blog).

1 comment:

  1. Im presuming your going to swap "Error" with "return to select" otherwise the buggy will just freeze and do nothing

    ReplyDelete