1

Dependencies:   mbed

Committer:
sunghunKim
Date:
Sun Mar 07 12:04:37 2021 +0000
Revision:
0:d039f36b5a64
2

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sunghunKim 0:d039f36b5a64 1 #include "mbed.h"
sunghunKim 0:d039f36b5a64 2
sunghunKim 0:d039f36b5a64 3 // Initialize a pins to perform analog input and digital output fucntions
sunghunKim 0:d039f36b5a64 4 AnalogIn temperature1(A0);
sunghunKim 0:d039f36b5a64 5 AnalogIn humadity1(A1);
sunghunKim 0:d039f36b5a64 6 AnalogIn temperature2(A2);
sunghunKim 0:d039f36b5a64 7 AnalogIn humadity2(A3);
sunghunKim 0:d039f36b5a64 8 AnalogIn co2(A4);
sunghunKim 0:d039f36b5a64 9
sunghunKim 0:d039f36b5a64 10 int main(void)
sunghunKim 0:d039f36b5a64 11 {
sunghunKim 0:d039f36b5a64 12 while (1) {
sunghunKim 0:d039f36b5a64 13
sunghunKim 0:d039f36b5a64 14 // 10v analog output
sunghunKim 0:d039f36b5a64 15 printf("t1: %3.1f\t", temperature1.read() * 44.0f);
sunghunKim 0:d039f36b5a64 16 printf("h1: %3.1f\t", humadity1.read() * 90.0f);
sunghunKim 0:d039f36b5a64 17
sunghunKim 0:d039f36b5a64 18 // 5v analog output
sunghunKim 0:d039f36b5a64 19 printf("t2: %3.1f\t", temperature2.read() * 48.0f);
sunghunKim 0:d039f36b5a64 20 printf("h2: %3.1f\t", humadity2.read() * 115.0f);
sunghunKim 0:d039f36b5a64 21
sunghunKim 0:d039f36b5a64 22 printf("co2: %3.1f\n", co2.read() * 100.0f);
sunghunKim 0:d039f36b5a64 23 wait(0.2f);
sunghunKim 0:d039f36b5a64 24 }
sunghunKim 0:d039f36b5a64 25 }