EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Topics / Help needed in implementing obstacle detection logic

Help needed in implementing obstacle detection logic

|

Microcontroller › AVR › Help needed in implementing obstacle detection logic

  • This topic has 2 replies, 2 voices, and was last updated 13 years, 2 months ago by AJISH ALFRED.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • February 29, 2012 at 7:14 am #1620
    Aji
    Participant

    Hi Folks,

     

    Am working on obstacle detector whose analog output is analog input to Atmega32 micro. I am taking five samples of my analog input to confirm the presence of obstacle. I have kept a cut off value based on the volatage output of the obstacle detector. It is not working consistently, am not getting where is the defect, so can anyone help me plz or suggest any other way of implemening?

    Sample of code is lik dis, timer will be loaded with 100ms

     

    #define obs_cut_off 0x10;

    #define cut_off_high ;

    #define cut_off_low ;

    #define cut_off  5;

     

    if (timer_obs.expired == true)

    {

      init_obs_timer();

      timer_obs.enabled = true;

     

      if(analoginput[0] > obs_cut_off )

      {

        cut_off_high ++;

        cut_off_low –;

      }

      else

      {

        cut_off_high –;

        cut_off_low ++;

      }

     

      if(cut_off-high>=cut_off)

      {

        obstacle_detected = true;

        cut_off_high= 0;

        cut_off_low=0;

      }

      else if (cut_off-low>=cut_off)

      {

        obstacle_detected = false;

        cut_off_high= 0;

        cut_off_low=0;

      }

     

    Looking forward for help.

     

    Rgds,

    DD

     

     

    Fnds plz help me, I have not got any replies till now. If U find any loophole i n pgm plz reply:(. Waiting for replies

     

    April 2, 2012 at 6:09 am #7380
    Aji
    Participant

    Folks,

     

    can any one plz reply:(

     

    Rgds,

    Deeps

    April 12, 2012 at 10:13 am #7421
    AJISH ALFRED
    Participant

    Try changing your second and third line of your code.

    You should define some value before using the macro in your code

    Example:

    #define cut_off_high  0;

    #define cut_off_low  0;

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • Can I make two inputs from one?? June 21, 2025
  • Beats Solo 4 June 21, 2025
  • Behlke swich June 21, 2025
  • Is AI making embedded software developers more productive? June 21, 2025
  • Simple LED Analog Clock Idea June 21, 2025

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise