λͺ©λ‘μ 체 κΈ (1005)
π 곡λΆνλ μ§μ§μνμΉ΄λ μ²μμ΄μ§?
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/cr2gv8/btsCpfG70Fp/coKcu7IKwUZRJwoKvmVGZK/img.png)
β Station π© sub MQ135 (Co2 κ°μ€ μΈ‘μ μΌμ) 3 κ°μ κ°λ€μ topic λ³λ‘ λ°μμ LCD λ‘ μΆλ ₯νκΈ° π© pub μ΄μν μΌμ 2κ°λ‘ 거리λ₯Ό μΈ‘μ νλ©° λμ μ¬λΆλ₯Ό μλ¦Ό -> μ΄λ₯Ό κΈ°κ΄μ¬μκ² pub λ‘ μ μ‘ λ²νΌ 2κ°λ‘ μ€ν¬λ¦° λμ΄ κ³ μ₯ (0, 1) μ κ°μ νμ¬ κ³ μ₯ μ¬λΆλ₯Ό μλ¦Ό -> μ΄λ₯Ό κΈ°κ΄μ¬μκ² pub λ‘ μ μ‘ β MQ135_SUB & Door_Button_PUB #include "WiFiS3.h" #include #include #include #include #include #include // atof ν¨μκ° μ μΈλ ν€λ νμΌ #include // WiFi and MQTT μ ν #define WLAN_SSID "class924" #define WLAN_PASS "kosta9..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/c9OtjF/btsCr81xccy/xgT2Agacx4r3HKpNLCadW1/img.png)
β Subway π© pub MQ135 (Co2 κ°μ€ μΈ‘μ μΌμ) 3 κ°μ κ°λ€μ freeRTOS λ‘ λ°μμ PUB λ‘ λ³΄λ΄κΈ° MQ135 (Co2 κ°μ€ μΈ‘μ μΌμ) 3 κ°μ κ°λ€μ LCD λ‘ μκ°ννκΈ° β MQ135_PUB #include #include "WiFiS3.h" #include #include #include #define INCLUDE_vTaskDelayUntil = 1 #include #include // WiFi and MQTT settings #define WLAN_SSID "class924" #define WLAN_PASS "kosta90009" #define MQTT_SERVER "192.168.0.154" #define MQTT_PORT 1883 #define MQ135_PIN_1..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/ltNiK/btsCsnxlSxg/GUxHnI013hD5F8Ji1kQ4ck/img.png)
β Sqlite3 sqlite3 dbνμΌλͺ .db >> .mode table >> .tables >> select * from ν μ΄λΈλͺ ; β db νμΌ (main.c) μ€ννκΈ° // gcc -g -o main main.c -lpaho-mqtt3c -lsqlite3 β Ultrasonic + button // main.c #include #include #include #include // CμΈμ΄λ‘ ꡬνλ SQL λ°μ΄ν° λ² μ΄μ€ μμ§ #include #include #include // MQ Telemetry Transport λ²μ 3.1 νλ‘ν μ½μ λν // C ꡬνμ ν΄λΌμ΄μΈνΈ κΈ°λ₯μ΄ ν¬ν¨λ 32λΉνΈ Windows λΌμ΄λΈλ¬λ¦¬ #include #define MQTT_HOST "192.168.0.154" #d..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/bbIHPj/btsCpNDy0gp/MA1Mdga0CaZi1WUX8mNcTK/img.png)
β MQTT β pub.ino #include #include "WiFiS3.h" #include #include #include // WiFi and MQTT settings #define WLAN_SSID "class924" #define WLAN_PASS "kosta90009" #define MQTT_SERVER "192.168.0.154" #define MQTT_PORT 1883 #define MQ135_PIN_1 A0 #define MQ135_PIN_2 A1 char ssid[] = WLAN_SSID; char pass[] = WLAN_PASS; int keyIndex = 0; WiFiClient ethClient; PubSubClient mqtt(ethClient); int status = W..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/csZRW3/btsCrayyVOP/W1cA8NgYVIeYkQh6qfrtj1/img.png)
β MQTT β pub.ino #include "WiFiS3.h" #include #include // WiFi and MQTT μ ν #define WLAN_SSID "class924" #define WLAN_PASS "kosta90009" #define MQTT_SERVER "192.168.0.154" #define MQTT_PORT 1883 #define TRIG 9 // TRIG ν μ€μ (μ΄μν 보λ΄λ ν) #define ECHO 8 // ECHO ν μ€μ (μ΄μν λ°λ ν) ///////please enter your sensitive data in the Secret tab/arduino_secrets.h char ssid[] = WLAN_SSID; // your network SSID (na..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/Ca9fn/btsCt4KPPRj/EK32R06LvB4KWqNMwoIfe0/img.png)
β MQTT β pub.ino #include "WiFiS3.h" #include #include // WiFi and MQTT μ ν #define WLAN_SSID "class924" #define WLAN_PASS "kosta90009" #define MQTT_SERVER "192.168.0.154" #define MQTT_PORT 1883 #define MQ135_PIN A0 char ssid[] = WLAN_SSID; char pass[] = WLAN_PASS; int keyIndex = 0; WiFiClient ethClient; PubSubClient mqtt(ethClient); int status = WL_IDLE_STATUS; WiFiServer server(80); void setup(..
β MQTT β pub.ino //pub.ino #include "WiFiS3.h" #include #include // WiFi and MQTT μ ν #define WLAN_SSID "class924" #define WLAN_PASS "kosta90009" #define MQTT_SERVER "192.168.0.51" #define MQTT_PORT 1883 #define MQTT_USERNAME "your_mqtt_username" #define MQTT_KEY "your_mqtt_password" #define TRIG 9 // TRIG ν μ€μ (μ΄μν 보λ΄λ ν) #define ECHO 8 // ECHO ν μ€μ (μ΄μν λ°λ ν) ///////please enter your sensitive ..
β MQTT ver.broker β pub.c // pub.c #include #include #include #include #include #include #include // μλ¦¬μΌ μ½λ typedef struct { int fd; } SerialPort; int serial_open2(SerialPort *port, const char *device) { port->fd = open(device, O_RDWR | O_NOCTTY | O_NDELAY); if (port->fd == -1) { perror("Unable to open port"); return -1; } struct termios options; tcgetattr(port->fd, &options); cfsetispeed(&optio..