ping pong projekt
Dependencies: interupt mbed resetpolja pozicijaLoptice resetALL Ispis PozicijaOdbijaca
projekt je izveden s 8x8 led matricom na kojoj se igra ping pon pomoću potenciometara.
Diff: main.cpp
- Revision:
- 0:e7d047a7fe29
diff -r 000000000000 -r e7d047a7fe29 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Feb 22 08:33:54 2021 +0000 @@ -0,0 +1,50 @@ +#include "mbed.h" +#include "resetpolja.h" +#include "Ispis.h" +#include "PozicijaOdbijaca.h" +#include "pozicijaLoptice.h" +#include "reset_polja.h" +#include "Interupt.h" + +extern int polje[8][8]; +extern int StartStop; +extern Timer timer1,timer3,debounce; +Timer timer2; +extern InterruptIn button; + +void ispis(void); +void pozicija_odbijaca(void); +void PozicijaLoptice (void); +void ResetPoljaLoptice (void); +void ResetPolja (void); +void toggle(void); + +int main() +{ + L8=0; L9=0; L10=0; L11=0; L12=0; L13=0; L14=0; L15=0; G1=0; G2=0; G3=0; + timer1.start(); // start timer counting + timer2.start(); + timer3.start(); + + while(1) { + + if(timer2.read_ms() >= 400){ + ResetPoljaLoptice(); + PozicijaLoptice(); + timer2.reset(); + timer3.reset(); + } + + pozicija_odbijaca(); + ispis(); + debounce.start(); + button.rise(&toggle); + while(StartStop==0){ResetPolja(); ispis();} +} +} + + + + + +