Go Down

Topic: Switch Case for Self Docking Robot (Read 630 times) previous topic - next topic

nshaiman

Hi, I need my c code functions in Arduino,

typedef enum { Avoid, IR_detected, Stop, Charging_Start } stateMachine;
stateMachine simpleState = Avoid;  //initialise statemachine


switch (simpleState)
      {
      
case Avoid:                                     
 

my first state is Avoid until robot detects ir signal.
Thanks

PaulS

Quote
my first state is Avoid until robot detects ir signal.
What, exactly, is it the robot should avoid? Red meat and alcohol?
The art of getting good answers lies in asking good questions.

nshaiman

Hi, I am working on Self Recharging Robot which goes to Docking system when its battery charge is low. for that i am using one Ultrasonic Sensor on front of robot, to Avoid the obstacles, and 5 I.R sensors to locate Docking station which transmitting Infrared signal. When i turned the robot on it goes straight into AVOID state and Ultrasonic Sensor is functional. but when any of I.R receiver on robot receives Infrared signal the robot goes to State IR_detected and the it looks for front sensor to get Infrared signal. once it receives signal then it goes towards docking station and stop to charge itself

Thanks

Go Up