run with easy module shield

Dependencies:   mbed

Fork of CDS_HelloWorld_WIZwiki-W7500 by IOP WIZnet

Committer:
IOP
Date:
Tue Aug 04 07:01:24 2015 +0000
Revision:
5:07cf6e09cd27
Parent:
4:9866fbe66750
Child:
7:17a6ae52f531
pin porting changed for w7500

Who changed what in which revision?

UserRevisionLine numberNew contents of line
joon874 0:fe7126797254 1 #include "mbed.h"
joon874 0:fe7126797254 2
IOP 5:07cf6e09cd27 3 DigitalOut myled_R(LED_RED); // LED_RED on WIZwiki-W7500
IOP 5:07cf6e09cd27 4 DigitalOut myled_B(LED_BLUE); // LED_BLUE on WIZwiki-W7500
IOP 5:07cf6e09cd27 5 AnalogIn CDS(A0); // Analog Input Pin A0
joon874 0:fe7126797254 6
joon874 0:fe7126797254 7 int main() {
IOP 5:07cf6e09cd27 8 printf("Hello WizWIki-W7500!\r\n");
IOP 5:07cf6e09cd27 9 printf("==============================\r\n");
joon874 0:fe7126797254 10
joon874 0:fe7126797254 11 int CDS_data = 0;
joon874 0:fe7126797254 12 double CDS_vol = 0;
joon874 0:fe7126797254 13
joon874 0:fe7126797254 14 while(1) {
joon874 0:fe7126797254 15 CDS_data = CDS.read()*1000;
joon874 0:fe7126797254 16 CDS_vol = CDS.read()*3.3;
joon874 0:fe7126797254 17
joon874 0:fe7126797254 18 //CDS Seneor ADC Low Data
joon874 0:fe7126797254 19 printf("CDS Data : %3d\r\n",CDS_data);
joon874 0:fe7126797254 20 //CDS Sensor Voltage data
joon874 0:fe7126797254 21 printf("CDS Voltage : %3.3lfV\r\n",CDS_vol);
IOP 5:07cf6e09cd27 22 printf("===========================\r\n");
IOP 5:07cf6e09cd27 23 wait(1.0);
joon874 0:fe7126797254 24
IOP 5:07cf6e09cd27 25 //Status is Dark and RED LED ON, BLUE LED OFF
joon874 0:fe7126797254 26 if(CDS_data < 500){
IOP 4:9866fbe66750 27 myled_R = 1;
IOP 4:9866fbe66750 28 myled_B = 0;
joon874 0:fe7126797254 29 }
IOP 5:07cf6e09cd27 30 //Status is Bright and BLUE LED ON, RED LED OFF
joon874 0:fe7126797254 31 else {
IOP 4:9866fbe66750 32 myled_R = 0;
IOP 4:9866fbe66750 33 myled_B = 1;
joon874 0:fe7126797254 34 }
joon874 0:fe7126797254 35 }
joon874 0:fe7126797254 36 }