Node-RED 우노빅보드 스마트팜/우노빅보드와 Node-RED 연동 (22) 썸네일형 리스트형 Node-Red 대쉬보드로 UDP 데이터 송신 우노빅보드 + ESP8266 연결 우노빅보드와 ESP8266을 연결합니다. ESP8266 명령어 수행 함수 command 변수에 명령어를 전달하면 결과값을 프린트합니다. String esp8266Data(String command, const int timeout, boolean debug) { if (debug) { Serial.print("CMD: "); Serial.println(command); } String response = ""; esp8266Serial.print(command); long int time = millis(); while ( (time + timeout) > millis()) { while (esp8266Serial.available()) { char c = esp8266.. ESP8266 연결 & 이더넷 동작 테스트 우노빅보드 디지털핀 2번, 3번과 ESP8266 RX, TX를 연결합니다. 소프트웨어 시리얼을 이용하여 ESP8266을 사용합니다. #include #define DEBUG true #define RXPIN 3 #define TXPIN 2 SoftwareSerial esp8266Serial(RXPIN,TXPIN); //Pin 5 & 3 of Arduino as RX and TX. Connect TX and RX of ESP8266 respectively. String esp8266Data(String command, const int timeout, boolean debug) { String response = ""; esp8266Serial.print(command); long int time = mi.. NGINX webserver 설치 on Windows 설치파일 다운로드 http://nginx.org/en/download.html nginx: download nginx.org Nginx 디렉토리 리스트 서비스 구현 nginx.conf파일을 수정합니다. 사진 이미지 리스트 디텍토리를 포함합니다. node-red 대쉬보드에서 사이트링크 기능 template 노드를 추가합니다. 스마트팜 사진 리스트 ftp 서버 설치 on windows 파일질라 서버 다운로드 파일질라는 오픈소스 크로스 플랫의 자유 소프트웨어인 FTP 프로그램입니다. 서버 프로그램과 클라이언트 프로그램으로 구성되어 있습니다. https://filezilla-project.org/ 프로그램을 설치하고 서버정보를 설정합니다. 접속 계정을 추가합니다. 그리고 ftp 공유 폴더를 추가합니다. node-red 와 연동해서 사용하기 때문에 nodejs 폴더내에 ftp 폴더를 만들겠습니다. ftp 서버 주소와 사용자명 / 비밀번호를 정확히 입력하고 확인을 누르면 서버 접속을 시도합니다. ftp 클라이언트 프로그램으로 접속 테스트합니다. 성공적으로 연결이 되었습니다. 웹브라우져에서 ftp 로그인하여 ftp 폴더내에 있는 파일을 볼수 있고 다운로드 할 수 있습니다. 당연히 사용자명/ 비.. 우노빅보드 온도센서 연동 on Node-RED 우노빅보드 우노빅보드 9번핀과 온도센서 DHT11 시그널핀과 연결합니다. 아두이노 소스코드 #include #include #define DHTPIN 9 #define DHTTYPE DHT11 DHT dht(DHTPIN, DHTTYPE); // 온도 습도 데이터 얻기 int temperature, humidity; // 온도 습도를 읽기전 하드웨어 컨트롤 int request_humidity_temperature() { int err; float h = dht.readHumidity(); float t = dht.readTemperature(); Serial.print(h); Serial.print(','); Serial.println(t); temperature = (int)t; humidity = (.. 우노빅보드 버튼 연동 on Node-RED 우노빅보드 우노빅보드에 버튼 모듈을 7번핀과 연결합니다. 시리얼로 버튼이 눌려지면 1을 해제되면 0을 출력하도록 프로그래밍합니다. int buttonPin = 7; byte lastState = LOW; void setup() { // put your setup code here, to run once: Serial.begin(9600); pinMode(buttonPin, INPUT_PULLUP); } void loop() { // put your main code here, to run repeatedly: byte currentState = digitalRead(buttonPin); if(currentState != lastState) { lastState = currentState; // Seria.. 이전 1 2 3 다음