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.
main.cpp
- Committer:
- atopcic
- Date:
- 2021-02-22
- Revision:
- 0:e7d047a7fe29
File content as of revision 0:e7d047a7fe29:
#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();} } }