Antonia Baumgartner / Mbed 2 deprecated YB_copy

Dependencies:   mbed

Fork of Versuch21 by Antonia Baumgartner

Classes/IRSensorGF.cpp

Committer:
mrbb2
Date:
2018-04-23
Revision:
1:6ef5bc60e69c
Parent:
0:b886f13e4ac6
Child:
2:efa9a78591da

File content as of revision 1:6ef5bc60e69c:

#include <cmath>
#include "IRSensorGF.h"

using namespace std;

IRSensorGF::IRSensorGF(AnalogIn& distance):

    distance(distance)
{


}

IRSensorGF::~IRSensorGF() {}

int IRSensorGF::read()
{
    int d;

    /*if (3300*(distance)>2900){     //5-6cm
       d=1;
       }
    else{
       d=0;
       }*/

    int w = 10/(distance)*exp(1.4481);

    if (w < 60) {
        d=1;
    }else{
        d=0;
        }

        return d;

    }