#include "capteur.h"




capteur::capteur(PinName sda, PinName scl): i2c (sda, scl)
{
}
    
    
char* capteur::return_temp (void)
{
        do{
            i2c.write(EZO_RTD, "R",1,0);//
            wait(0.6);
            i2c.read(EZO_RTD, res, 7,0);
            //code((int) res[0]);
            } while((int)res[0]!=1);
        
       return res+1;
}
char* capteur::return_pH (void)
{
    
        do{
            i2c.write(EZO_pH, "R",1,0);
            wait(0.9);
            i2c.read(EZO_pH, res_ph, 7,0);
            //code((int) res[0]);
            } while((int)res_ph[0]!=1);
        
        return res_ph+1;
}
char* capteur::return_EC (void)
{
    
        do{
            i2c.write(EZO_EC, "R",1,0);
            wait(0.6);
            i2c.read(EZO_EC, res_ec, 7,0);
            //code((int) res[0]);
        } while((int)res_ec[0]!=1);
    
        return res_ec+1;
}
char* capteur::return_DO (void)
{
     
        do{
            i2c.write(EZO_DO, "R",1,0);
            wait(0.6);
            i2c.read(EZO_DO, res_do, 7,0);
            //code((int) res[0]);
        } while((int)res_do[0]!=1);
        
        return res_do+1;
}
