Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
mAIn_2.cpp@0:f0bb7332032f, 2018-11-15 (annotated)
- Committer:
- martwerl
- Date:
- Thu Nov 15 18:04:45 2018 +0000
- Revision:
- 0:f0bb7332032f
mbedAnalogIn
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| martwerl | 0:f0bb7332032f | 1 | /*#include "mbed.h" |
| martwerl | 0:f0bb7332032f | 2 | #include "C12832.h" |
| martwerl | 0:f0bb7332032f | 3 | |
| martwerl | 0:f0bb7332032f | 4 | C12832 lcd(p5, p7, p6, p8, p11); |
| martwerl | 0:f0bb7332032f | 5 | AnalogIn aiPoti1(p19); |
| martwerl | 0:f0bb7332032f | 6 | AnalogIn aiPoti2(p20); |
| martwerl | 0:f0bb7332032f | 7 | |
| martwerl | 0:f0bb7332032f | 8 | int main() { |
| martwerl | 0:f0bb7332032f | 9 | unsigned short adcWert2; |
| martwerl | 0:f0bb7332032f | 10 | lcd.cls(); // löscht lcd (clear screen) |
| martwerl | 0:f0bb7332032f | 11 | lcd.locate(0,0); // x-position, y-position (x: 0-128; y: 0-32) |
| martwerl | 0:f0bb7332032f | 12 | lcd.printf("Werte von Poti 1 und 2:"); |
| martwerl | 0:f0bb7332032f | 13 | while(1) { |
| martwerl | 0:f0bb7332032f | 14 | lcd.locate(0,10); |
| martwerl | 0:f0bb7332032f | 15 | lcd.printf("Spannung 1 = : %f V", aiPoti1.read()*3.3); |
| martwerl | 0:f0bb7332032f | 16 | adcWert2 = aiPoti2.read_u16(); |
| martwerl | 0:f0bb7332032f | 17 | lcd.printf("\nADC 2 = 0X%04X / %05d", adcWert2, adcWert2 ); |
| martwerl | 0:f0bb7332032f | 18 | wait_ms(100); |
| martwerl | 0:f0bb7332032f | 19 | } |
| martwerl | 0:f0bb7332032f | 20 | } |
| martwerl | 0:f0bb7332032f | 21 | */ |