![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
USB CDC CLASS MBED
main.cpp
- Committer:
- franni
- Date:
- 2018-10-10
- Revision:
- 0:6b657e23c254
File content as of revision 0:6b657e23c254:
#include "mbed.h" DigitalOut led_g(LED_GREEN); AnalogIn AN1(PTB0); Serial rs232(USBTX,USBRX); char c; float val_adc; void receivedByte() { c = rs232.getc(); if(c=='h') { led_g=1; } if(c=='l') { led_g=0; } } int main() { rs232.baud(9600); rs232.attach(&receivedByte); while(true) { val_adc=AN1; rs232.printf("Valor Lectura ADC\r\n"); rs232.printf("%f \n\r",val_adc); wait(0.1); } }