Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Idle function(share file)

denny9167

Member level 1
Joined
Apr 23, 2022
Messages
35
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Activity points
163
Here is a great function for those into both RF(OOK) or IR(PWM) communication, this function works for motor direction, which is a plus in robotics and other similar automations. Change IR_PIN designation and state depending on application, and also change TimerH value to adjust delay after timeout.

Code:
void Idle(){

     uint8_t TimerL = 0;
     uint8_t TimerH = 75;
 
    // IR receiver idles with output HIGH , so wait until it goes LOW
    // When hold down timer expires all momentary outputs are forced off
    while(IR_PIN) {
        if(--TimerL == 0) {
           if(--TimerH == 0) {
                F_momentary = 1;
                if(F_momentary) {
                   // Clear any output when timer expires.
                
                }
             }
          }
       }
    }
 
Last edited:

LaTeX Commands Quick-Menu:

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top