Reproduces problem with having different analogIn in both ticker and main

Dependencies:   mbed

main.cpp

Committer:
lanfear
Date:
2015-02-26
Revision:
0:a085abcfd4f8

File content as of revision 0:a085abcfd4f8:

#include "mbed.h"

DigitalIn Button1(p21);    
DigitalOut led1(LED1);

AnalogIn Joystick1(p18);    
AnalogIn Ain3(p15);

float LFT;                 
int LowBatteryCounter=0;

Ticker VoltageCheck_tick;               

void LowBatteryShutDown(void); 
       

int main() 
{
    VoltageCheck_tick.attach(&LowBatteryShutDown,0.5);  
      
    while(1) 
    {
       if (Button1==1)
       {
             LFT = Joystick1;
       } 
    }
}

void LowBatteryShutDown(void)  
{
    led1 = !led1;
    
    if(Ain3<=0.81)
    {
        LowBatteryCounter++;
    }
}