Kamil Kanas
/
Nucleo_PWM_Serial_Motor_Controller
PWM motor controler. Serial DAQ float 0 upto 1
main.cpp
- Committer:
- kanatronics
- Date:
- 2016-06-24
- Revision:
- 1:a3dae8744a7d
- Parent:
- 0:d26101f286c4
File content as of revision 1:a3dae8744a7d:
/*Kamil Kanas Nucleo PWM to Serial motor controller Rev 1.1 */ #include "mbed.h" Serial pc(USBTX,USBRX); PwmOut led(D13); float pwmOut; //PWM port char buffer[16]; int main() { pc.baud(115200); //Set baud rate while (1){ led=pwmOut; while(true){ if(pc.readable()) { //if data in the ring buffer pc.gets(buffer, 8); pc.printf("DataReceived %s \n", buffer); pwmOut=atof(buffer); pc.printf("%2.2f\n",pwmOut); break; } } } }