Page 86 - 2
P. 86

나 아두이노에서 데이터 처리를 위한 프로그램 소스.


            #include <Wire.h>
            #include <LiquidCrystal_I2C.h>
            #include "sound_effect.h"


            LiquidCrystal_I2C lcd(0x3f,16,2);


            int blue_pin = 2;
            int green_pin = 3;
            int red_pin = 4;
            int pin = 8;
            int buzzer_pin = 13;
            unsigned long duration;
            unsigned long starttime;
            unsigned long sampletime_ms = 5000;
            unsigned long lowpulseoccupancy = 0;
            float ratio = 0;
            float concentration = 0;
            float pcsPerCF = 0;
            float ugm3 = 0;
            uint8_t clock[8] = {0x0, 0xe, 0x15, 0x17, 0x11, 0xe, 0x0};


            void setup() {
              Serial.begin(9600);
              pinMode(8,INPUT);
              pinMode(2,OUTPUT);
              pinMode(3,OUTPUT);
              pinMode(4,OUTPUT);
              pinMode(13,OUTPUT);
              digitalWrite(blue_pin, HIGH);
              digitalWrite(green_pin, HIGH);
              digitalWrite(red_pin, HIGH);
              starttime = millis();
              lcd.begin();
              lcd.backlight();
              lcd.clear();
              lcd.print("Hello! Meister!");
              lcd.setCursor(0, 1);
              lcd.print("<CHECK DUST>");
              lcd.createChar(1, clock);
              seSqueak(13);
              delay(5000);
              if( ugm3 == 0){
                lcd.clear();


                                                         - 86 -
   81   82   83   84   85   86   87   88   89   90   91