Page 97 - MDP2020-1
P. 97
················································································ 명장양성프로젝트 【MDP】 과제발표회 자료집 Ⅰ | 91
8. 소프트웨어 작성하기
가. 프로그램 흐름도
나. Arduino를 이용한 스마트 수조 기능 제어 시스템
-네오픽셀 제어
#include <Adafruit_NeoPixel.h>
#ifdef _AYR_
#include <arv/power.h>
#endif
#define PIN 6
#define NUM_LEDS 60
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, PIN, NEO_GRB + NEO_KHZ800 );
void setup() {
strip.setBrightness(50);
strip.begin();
strip.show();
pinMode(A0, INPUT);
}
void loop(){
double phValue = analogRead(A0);
strip.begin();
if(phValue > 472){
for(int i=0; i<NUM_LEDS; i++){
colorWipe(strip.Color(255,0,0,0),0);
delay(1500);
}