Karla Garcia
/
P6_E3
.
main.cpp@0:77181102b27d, 2020-05-30 (annotated)
- Committer:
- karlaivon
- Date:
- Sat May 30 00:53:48 2020 +0000
- Revision:
- 0:77181102b27d
.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
karlaivon | 0:77181102b27d | 1 | #include "mbed.h" |
karlaivon | 0:77181102b27d | 2 | #include "C12832.h" |
karlaivon | 0:77181102b27d | 3 | |
karlaivon | 0:77181102b27d | 4 | C12832 lcd(SPI_MOSI, SPI_SCK, SPI_MISO, p8, p11); |
karlaivon | 0:77181102b27d | 5 | |
karlaivon | 0:77181102b27d | 6 | AnalogIn Ain(p20); |
karlaivon | 0:77181102b27d | 7 | float ADCdata, voltaje; |
karlaivon | 0:77181102b27d | 8 | |
karlaivon | 0:77181102b27d | 9 | int main () { |
karlaivon | 0:77181102b27d | 10 | while (1) { |
karlaivon | 0:77181102b27d | 11 | ADCdata=Ain; |
karlaivon | 0:77181102b27d | 12 | lcd.locate(0,3); |
karlaivon | 0:77181102b27d | 13 | lcd.printf("%f", ADCdata); |
karlaivon | 0:77181102b27d | 14 | voltaje=ADCdata * (3.3f/65535.0f)*100000; |
karlaivon | 0:77181102b27d | 15 | |
karlaivon | 0:77181102b27d | 16 | lcd.locate(0,16); |
karlaivon | 0:77181102b27d | 17 | lcd.printf("%f", voltaje); |
karlaivon | 0:77181102b27d | 18 | printf("%f /n/r", ADCdata); |
karlaivon | 0:77181102b27d | 19 | wait(0.5); |
karlaivon | 0:77181102b27d | 20 | |
karlaivon | 0:77181102b27d | 21 | } |
karlaivon | 0:77181102b27d | 22 | } |