Code for testing the ELEC1620 Application Board.
Dependencies: N5110 ShiftReg Tone mbed
Diff: Main/main.cpp
- Revision:
- 1:9359b8534c79
- Parent:
- 0:fabfe08aee13
diff -r fabfe08aee13 -r 9359b8534c79 Main/main.cpp --- a/Main/main.cpp Wed Nov 01 09:44:56 2017 +0000 +++ b/Main/main.cpp Wed Nov 01 20:54:21 2017 +0000 @@ -48,7 +48,7 @@ test_7seg(); leds = 0x0F; // on-board LEDs speaker.play(1000.0,2.0); - + // loop forever while(1) { @@ -129,8 +129,8 @@ void test_ldr() { float value = ldr.read(); // read in the LDR value in range 0.0 to 1.0 - char buffer[14]; - + char buffer[14]; + sprintf(buffer,"LDR=%.2f",value); // print formatted data to buffer lcd.printString(buffer,0,2); // display on screen } @@ -139,24 +139,26 @@ { float value = 3.3*tmp36.read(); // read in the TMP36 value in range 0.0 to 1.0 float temperature = 100.0f*value - 50.0f; - char buffer[14]; - + char buffer[14]; + sprintf(buffer,"T=%.4f C",temperature); // print formatted data to buffer lcd.printString(buffer,0,3); // display on screen } -void test_pots() { - - char buffer[14]; +void test_pots() +{ + + char buffer[14]; float val = pot_0.read(); sprintf(buffer,"%.2f",val); // print formatted data to buffer lcd.printString(buffer,0,5); // display on screen + lcd.setContrast(val); // tune LCD contrast val = pot_1.read(); sprintf(buffer,"%.2f",val); // print formatted data to buffer lcd.printString(buffer,28,5); // display on screen - + val = pot_2.read(); sprintf(buffer,"%.2f",val); // print formatted data to buffer lcd.printString(buffer,56,5); // display on screen