run with easy module shield

Dependencies:   mbed

Fork of CDS_HelloWorld_WIZwiki-W7500 by IOP WIZnet

main.cpp

Committer:
joon874
Date:
2015-07-07
Revision:
0:fe7126797254
Child:
2:560e0b46e225

File content as of revision 0:fe7126797254:

#include "mbed.h"
 
DigitalOut redled(LED1); // RED
DigitalOut blueled(LED3); // BLUE
AnalogIn CDS(A0);
 
int main() {
    printf("Hello WizWIki-W7500!\n\r");
    printf("===========================================\n\r");
    
    int CDS_data = 0;
    double CDS_vol = 0;
    
    while(1) {
        CDS_data = CDS.read()*1000;
        CDS_vol = CDS.read()*3.3;
        
        //CDS Seneor ADC Low Data
        printf("CDS Data : %3d\r\n",CDS_data);      
        //CDS Sensor Voltage data
        printf("CDS Voltage : %3.3lfV\r\n",CDS_vol);
        printf("===========================================\n\r");
        
        wait(1);     
        //Status is dark.
        if(CDS_data < 500){
            redled = 1;
            blueled = 0;
        }
        //Status is bright.
        else  {
            redled = 0;
            blueled = 1;
        }
    }
}