Library koji prima znakove preko bluetooth modula i prema tome izvrsava zadane radnje
Citanjeznaka.cpp
- Committer:
- leleracic
- Date:
- 2020-11-26
- Revision:
- 0:3276e35a8063
File content as of revision 0:3276e35a8063:
#include "Citanjeznaka.h" #include "potenciometar.h" Serial bluetooth(PA_9, PA_10); Serial pc(USBTX,USBRX); char rx; int start=0; Ticker flipper; void flip() { // flip function kreni = !kreni; } int Citanjeznaka(void){ if(bluetooth.readable()) { rx = bluetooth.getc(); //pc.printf("%c\n\r",rx); if(rx == 'P'){ kreni=1; flipper.attach(&flip, 0.2); } if(rx == 'N') { flipper.detach(); kreni=1; stop=0; start=0; buzzer=0.5; buzzer.period(0.0028); } if(rx == 'R') { flipper.detach(); kreni=0; stop=1; start=1; } if(rx=='G'){ flipper.detach(); kreni=0; stop=0; start=0; buzzer=0.0; } } return start; }