![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
testing n-bed
Diff: main.cpp
- Revision:
- 0:8cd63f1ec3c9
- Child:
- 1:998fdef84813
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Jan 22 14:50:37 2015 +0000 @@ -0,0 +1,42 @@ +// N.C. testing n-bed LCD + + +#include "mbed.h" +#include "TextLCD.h" + +//n-bed CONNECTOR "L" JP6 +TextLCD lcd(p17, p20, p24, p23, p22, p8, TextLCD::LCD20x4); // rs, e, d4-d7 + +//n-bed CONNECTOR "K" JP7 +//Drive LCD from NON mbed pins +TextLCD lcd2(P1_19, P1_22, p15, P1_25, P1_26, P1_27, TextLCD::LCD20x4); // rs, e, d4-d7 + +Timer t; +DigitalOut led1(LED1); + +//Measure from a NON mbed analog pin +AnalogIn input(P0_2); //the range of the analog input goes, from 0 V. to 3.3V. the actual value is represented as a float from 0 to 1. +float ain; //ain must be a float, for matching the input.read type. + +int main() { + t.start(); + lcd.cls(); + wait(1); + lcd.printf("Hello LCD World!\n"); lcd2.printf("Hello 2ND Display\n"); + while (1) { + led1 = 1; + ain=input.read(); + lcd.locate(0,2); lcd2.locate(0,2); + lcd.printf("%1.1f mhnVolt", ( float(3.3)*ain) ) ; lcd2.printf("%1.1f mhnVolt", ( float(3.3)*ain) ) ; + wait(0.001); + ain=input.read(); + lcd.locate(0,3); lcd2.locate(0,3); + lcd.printf("%1.1f Volt", ( float(3.3)*ain) ) ; lcd2.printf("%1.1f Volt", ( float(3.3)*ain) ) ; + led1 = 0; + wait(0.9); + } +} + + + +