Arduino Forum

Topics => Robotics => Topic started by: nshaiman on Feb 21, 2017, 01:06 am

Title: Switch Case for Self Docking Robot
Post by: nshaiman on Feb 21, 2017, 01:06 am
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
Title: Re: Switch Case for Self Docking Robot
Post by: PaulS on Feb 21, 2017, 11:03 am
Quote
my first state is Avoid until robot detects ir signal.
What, exactly, is it the robot should avoid? Red meat and alcohol?
Title: Re: Switch Case for Self Docking Robot
Post by: nshaiman on Feb 21, 2017, 08:00 pm
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