test code to log ldr value

Dependencies:   mbed

Committer:
ganesh70508
Date:
Thu Jan 05 11:00:59 2017 +0000
Revision:
0:e2162e735bfe
initial;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ganesh70508 0:e2162e735bfe 1 #include "mbed.h"
ganesh70508 0:e2162e735bfe 2
ganesh70508 0:e2162e735bfe 3 AnalogIn ldr(PTB1);
ganesh70508 0:e2162e735bfe 4 Serial pc(USBTX, USBRX); // tx, rx
ganesh70508 0:e2162e735bfe 5 int main() {
ganesh70508 0:e2162e735bfe 6 unsigned int value;
ganesh70508 0:e2162e735bfe 7 while(1) {
ganesh70508 0:e2162e735bfe 8 if(pc.readable()) {
ganesh70508 0:e2162e735bfe 9 if (pc.getc() == 'A')
ganesh70508 0:e2162e735bfe 10 value = ldr*100.0;
ganesh70508 0:e2162e735bfe 11 pc.printf("%2d\n",value);
ganesh70508 0:e2162e735bfe 12 }
ganesh70508 0:e2162e735bfe 13 wait(0.01);
ganesh70508 0:e2162e735bfe 14 }
ganesh70508 0:e2162e735bfe 15 }