s
Revision 0:641b73812fdf, committed 2017-01-19
- Comitter:
- tbogdan
- Date:
- Thu Jan 19 11:57:10 2017 +0000
- Commit message:
- Public
Changed in this revision
Semafor.cpp | Show annotated file Show diff for this revision Revisions of this file |
Semafor.h | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Semafor.cpp Thu Jan 19 11:57:10 2017 +0000 @@ -0,0 +1,21 @@ +#include "mbed.h" +#include "Semafor.h" + +Semafor1::Semafor1(PinName Pin):Semafor11(Pin){ + while(){ + Semafor1=0b10001; + }} + +void Semafor::pjesaci(){ + wait(4); + semafor1 = 0b10010; //Na semaforu 1 pali se crveno svjetlo za pješake + wait(2); + semafor1 = 0b11010; //Na semaforu 1 pali se žuto svjetlo za aute + wait(3); + semafor1 = 0b00110; //Na semaforu 1 pali se zeleno svjetlo za aute + wait(1); + semafor1 = 0b01010; //Na semaforu 1 pali se žuto svjetlo za aute + wait(3); + semafor1 = 0b10010; //Na semaforu 1 pali se crveno svjetlo za aute + wait(1); + } \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Semafor.h Thu Jan 19 11:57:10 2017 +0000 @@ -0,0 +1,17 @@ +#ifndef SEmaFOr_2017 +#define SEmaFOr_2017 + +#include "mbed.h" + +class Semafor{ + + public: + Semafor1(PinName pin); + void pjesaci(); + + private: + BusOut Semafor1; + + } + +#endif \ No newline at end of file