Raul E Melo S
/
voltajeporserial
main.cpp@0:3281e994e83b, 2012-02-14 (annotated)
- Committer:
- raulmelo
- Date:
- Tue Feb 14 16:52:33 2012 +0000
- Revision:
- 0:3281e994e83b
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
raulmelo | 0:3281e994e83b | 1 | #include "mbed.h" |
raulmelo | 0:3281e994e83b | 2 | |
raulmelo | 0:3281e994e83b | 3 | AnalogIn IrSensor(p20); |
raulmelo | 0:3281e994e83b | 4 | Serial serial(USBTX, USBRX); |
raulmelo | 0:3281e994e83b | 5 | |
raulmelo | 0:3281e994e83b | 6 | int main() |
raulmelo | 0:3281e994e83b | 7 | { |
raulmelo | 0:3281e994e83b | 8 | float IrVoltage = 0; |
raulmelo | 0:3281e994e83b | 9 | |
raulmelo | 0:3281e994e83b | 10 | serial.baud(9600); |
raulmelo | 0:3281e994e83b | 11 | |
raulmelo | 0:3281e994e83b | 12 | while(1) { |
raulmelo | 0:3281e994e83b | 13 | IrVoltage=IrSensor.read(); |
raulmelo | 0:3281e994e83b | 14 | serial.printf("Voltage: %f\r\n", IrVoltage); |
raulmelo | 0:3281e994e83b | 15 | wait(1); |
raulmelo | 0:3281e994e83b | 16 | } |
raulmelo | 0:3281e994e83b | 17 | } |