Page 143 - 2
P. 143

}
            interrupt [ADC_INT] void adc_isr(void)// 진동
            {
                //  변환결과 10   비트를 count    변수에 저장. 0x00~0x3FF (0~1023)
                count = ADCW;
                if((count)>=600){
                    PORTD.5=1;
                    delay_ms(5000);
                    PORTD.5=0;
                    delay_ms(1000);
                }
            }
            interrupt [EXT_INT0] void external_int0(void)// 리드센서
            {
                PORTD.7 = 1;
                delay_ms(5000);
                PORTD.7 = 0;
                delay_ms(1000);
            }






            나 아두이노에서 데이터 처리를 위한 프로그램 소스.
            #include <ESP8266WiFi.h>


            String userKey = "uk75a4bq1wiqwpzh9skx8crd5gsnda";
            String apiToken = "aifx5u65spr8cvjhxobgprwu72yxse";
            String Title = "ESP8266 Pushover Test";


            const char* ssid = "wifi";   // 와이파이 이름
            const char* password = "00000000"; //  와이파이 비밀번호


            int mail = 5;   // 입력핀 D1=GPIO5
            int shock = 4;   // 입력핀 D2=GPIO4
            int state;      // 상태
            int state2;     // 상태2
            int length;        // 문자열 길이


            WiFiClient client;  // 와이파이 연결


             // 와이파이 설정
            void setup() {
              WiFi.begin(ssid, password);
              while (WiFi.status() != WL_CONNECTED) {
                delay(500);


                                                         - 143 -
   138   139   140   141   142   143   144   145   146   147   148