Martin Werluschnig
/
TINF_AnalogIn
Revision 0:4c1fac5a86f7, committed 2018-11-15
- Comitter:
- martwerl
- Date:
- Thu Nov 15 18:15:23 2018 +0000
- Commit message:
- TINF_AnalogIn
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C12832_lcd.lib Thu Nov 15 18:15:23 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/dreschpe/code/C12832_lcd/#8f86576007d6
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Nov 15 18:15:23 2018 +0000 @@ -0,0 +1,68 @@ +#include "mbed.h" +//#include "C12832.h" +#include "C12832_lcd.h" + + +//C12832 lcd(p5, p7, p6, p8, p11); + +C12832_LCD lcd; + +AnalogIn aiPoti1(p19); +AnalogIn aiPoti2(P1_31); //p20 + +int main() { + uint16_t wertP1; + uint16_t wertP2; + + lcd.cls(); // löscht lcd (clear screen) + //lcd.printf("Werte von Poti 1 und 2:"); + + + + while(1) { + + wertP1 = aiPoti1.read_u16(); + wertP2 = aiPoti2.read_u16(); + + wertP1 = wertP1/100; + wertP2 = wertP2/100; + + + lcd.locate(0,0); // x-position, y-position (x: 0-128; y: 0-32) + lcd.printf("Port1: %x", wertP1); + lcd.fillrect(0,10,wertP1,15,1); + lcd.width(); + lcd.fillrect(wertP1,10,100,15,1); + + + lcd.locate(0,17); // x-position, y-position (x: 0-128; y: 0-32) + lcd.printf("Port2: %x", wertP2); + lcd.fillrect(0,60,wertP2,25,1); + lcd.width(); + lcd.fillrect(wertP2,60,100,25,1); + + + + // lcd.locate(0,20); // x-position, y-position (x: 0-128; y: 0-32) + //lcd.printf("Port2: %x", wertP2); + //lcd.rect(0,40,wertP1,5,1); + + + + + /* + + lcd.locate(0,10); + lcd.printf("Spannung 1 = : %f V", aiPoti1.read()*3.3); + + lcd.locate(0,20); + lcd.printf("ADC-Wert = : %x", wertP1); + //lcd.printf("ADC-Wert = : %x", wertP1); + + + //lcd.printf("Spannung 2 = : %f V", aiPoti2.read()*3.3); + */ + wait_ms(100); + } +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Nov 15 18:15:23 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/aa5281ff4a02 \ No newline at end of file