Autor klase: Josip Lupinski

Mot_inter.cpp

Committer:
feri
Date:
2017-02-06
Revision:
0:a5f28c547fdb

File content as of revision 0:a5f28c547fdb:

#include "Mot_inter.h"
#include "mbed.h"

Mot_inter::Mot_inter(PinName pin1, PinName pin2, PinName tipka1, PinName tipka2):C(tipka1),D(tipka2)
{
    A = new PwmOut(pin1);
    B = new PwmOut(pin2);
    C.mode(PullUp);
    D.mode(PullUp);
    C.rise(this, &Mot_inter::pritisnuto);
    D.rise(this, &Mot_inter::pritisnuto);
}

void Mot_inter::naprijed()
{
    A->write(1);
    B->write(0);
}

void Mot_inter::natrag()
{
    A->write(0);
    B->write(1);
}

void Mot_inter::stop()
{
    A->write(0);
    B->write(0);
}

void Mot_inter::pritisnuto()
{
    stop();
}