Presentation is loading. Please wait.

Presentation is loading. Please wait.

센서값 전송하기 WiFi 시리얼 보드 활용가이드 김영준 헬로앱스 (www.helloapps.co.kr)

Similar presentations


Presentation on theme: "센서값 전송하기 WiFi 시리얼 보드 활용가이드 김영준 헬로앱스 (www.helloapps.co.kr)"— Presentation transcript:

1 센서값 전송하기 WiFi 시리얼 보드 활용가이드 김영준 헬로앱스 (

2 WiFi 코딩 업로드 전 준비사항 항상 WiFi 보드의 리셋 버튼을 클릭하여 보드를 초기화 해 놓고 아두이노 프로 그램을 업로드 해야 한다. 리셋버튼을 눌러 전원 초기화 리셋버튼이 눌려지면 WiFi 보드에서 실행중인 프로그램이 종료되고 다시 시작할 준비 상태가 됨

3 아두이노 센서값 전송하기

4 아날로그 센서 연결하기 아날로그 0번에 아무 아날로그 센서 하나를 연결한다. 본 예시에서는 조도센서를 연결하였다. 0번
(A0)

5 아날로그 센서 값을 읽어서 전송하기 Loop 함수에 다음과 같이 읽기 및 전송 명령어를 추가한다. void loop() {
void setup() { Serial.begin(115200); delay(200); wifi.begin(9600); delay(500); wifi.SSID("HA-12345"); Serial.print(wifi.Message()); wifi.Password("HelloApps"); wifi.StartAP(); } void loop() { int a = analogRead(0); wifi.WiFiWrite(a); delay(200); } wifi.WiFiWrite() 명령어는 외부로 값을 전송한다.

6 실행하기 실행 결과

7 웹서버에 접속 노트북이나 스마트폰에서 웹브라우저 실행 후, AP의 주소로 접속한다.

8 웹브라우저에서 페이지를 다시 불러온다. 새로고침으로 웹 페이지를 갱신해 본다. Write Data 항목에
조도 센서 값이 표시된다.

9 센서이름과 센서값 같이 전송하기

10 센서 이름과 값을 같이 전송하기 Loop 함수에 다음과 같이 수정된 전송 명령어를 추가한다. void loop() {
void setup() { Serial.begin(115200); delay(200); wifi.begin(9600); delay(500); wifi.SSID("HA-12345"); Serial.print(wifi.Message()); wifi.Password("HelloApps"); wifi.StartAP(); } void loop() { int a = analogRead(0); wifi.WiFiWrite("CDS", a); delay(200); } wifi.WiFiWrite() 명령어에서는 이름과 값을 같이 전송할 수 있다.

11 센서 이름과 값을 같이 전송하기 새로고침으로 웹 페이지를 갱신해 본다. Write Data 항목에 이름과 센서 값이
같이 표시된다.

12 여러 센서값 전송하기

13 여러 센서 값을 동시에 전송하기 Loop 함수에 다음과 같이 수정된 전송 명령어를 추가한다. void loop() {
void setup() { Serial.begin(115200); delay(200); wifi.begin(9600); delay(500); wifi.SSID("HA-12345"); Serial.print(wifi.Message()); wifi.Password("HelloApps"); wifi.StartAP(); } void loop() { int a0 = analogRead(0); int a1 = analogRead(1); wifi.WiFiWrite("CDS", a0); delay(100); wifi.WiFiWrite("PSD", a1); delay(200); }

14 여러 센서 값을 동시에 전송하기 새로고침으로 웹 페이지를 갱신해 본다. Write Data 항목에 여러 개의 센서값이
같이 표시된다.

15 센서 읽기와 LED 제어 동시에 하기

16 센서 읽기와 LED 제어 동시에 하기 센서값 전송과 LED 제어 동시에 하기 void loop() {
void setup() { Serial.begin(115200); delay(200); wifi.begin(9600); delay(500); wifi.SSID("HA-12345"); Serial.print(wifi.Message()); wifi.Password("HelloApps"); wifi.StartAP(); } void loop() { int a = analogRead(0); wifi.WiFiWrite("CDS", a); String s = wifi.WiFiRead(); if (s.length() > 0) Serial.println(s); if (s == "on") digitalWrite(13, HIGH); else if (s == "off") digitalWrite(13, LOW); } delay(200);


Download ppt "센서값 전송하기 WiFi 시리얼 보드 활용가이드 김영준 헬로앱스 (www.helloapps.co.kr)"

Similar presentations


Ads by Google