Isaac Cruz
/
Ejercicio_POT
Practica 7
main.cpp@32:69920613d52f, 2019-11-29 (annotated)
- Committer:
- isaacross99
- Date:
- Fri Nov 29 15:35:38 2019 +0000
- Revision:
- 32:69920613d52f
- Parent:
- 31:080589c1250a
Potenc
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dan | 0:7dec7e9ac085 | 1 | #include "mbed.h" |
rgsbuap | 26:29f649949409 | 2 | Serial pc(USBTX,USBRX); |
isaacross99 | 32:69920613d52f | 3 | AnalogIn pot(PTB2); |
isaacross99 | 32:69920613d52f | 4 | PwmOut led(PTC3); |
isaacross99 | 29:734b61eca6df | 5 | int main(){ |
isaacross99 | 32:69920613d52f | 6 | float leer, lim; |
isaacross99 | 32:69920613d52f | 7 | while(1){ |
isaacross99 | 32:69920613d52f | 8 | leer = pot.read_u16(); |
isaacross99 | 32:69920613d52f | 9 | lim = leer/65535; |
isaacross99 | 32:69920613d52f | 10 | pc.printf("\n%f",lim); |
isaacross99 | 32:69920613d52f | 11 | wait(0.2); |
isaacross99 | 32:69920613d52f | 12 | led.write(lim); |
isaacross99 | 32:69920613d52f | 13 | } |
isaacross99 | 28:868b283c5f77 | 14 | } |