Stjepan Skrnjug / H-most_Lupinski_Josip
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Mot_inter.cpp Source File

Mot_inter.cpp

00001 #include "Mot_inter.h"
00002 #include "mbed.h"
00003 
00004 Mot_inter::Mot_inter(PinName pin1, PinName pin2, PinName tipka1, PinName tipka2):C(tipka1),D(tipka2)
00005 {
00006     A = new PwmOut(pin1);
00007     B = new PwmOut(pin2);
00008     C.mode(PullUp);
00009     D.mode(PullUp);
00010     C.rise(this, &Mot_inter::pritisnuto);
00011     D.rise(this, &Mot_inter::pritisnuto);
00012 }
00013 
00014 void Mot_inter::naprijed()
00015 {
00016     A->write(1);
00017     B->write(0);
00018 }
00019 
00020 void Mot_inter::natrag()
00021 {
00022     A->write(0);
00023     B->write(1);
00024 }
00025 
00026 void Mot_inter::stop()
00027 {
00028     A->write(0);
00029     B->write(0);
00030 }
00031 
00032 void Mot_inter::pritisnuto()
00033 {
00034     stop();
00035 }