정보나눔

오픈소스하드웨어 프로젝트에 대한 다양한 정보를 나누는 공간입니다.

아크릴 날씨 무드등인 weather lamp를 하는데 컴파일 에러가 뜹니다 도와주세요 ㅠ
juzzys | 2018-06-18

exit status 1
보드 Arduino/Genuino Uno 컴파일 에러가 뜹니다 도와주세요 ㅠ

 

 

#include <SPI.h>


#include <Adafruit_NeoPixel.h>

uint8_t ret;

//initialize LED strip
Adafruit_NeoPixel strip = Adafruit_NeoPixel(20, 3, NEO_GRB + NEO_KHZ800);     //백그라운드 LED
Adafruit_NeoPixel strip1 = Adafruit_NeoPixel(4, 5, NEO_GRB + NEO_KHZ800);     //날씨 LED_비
Adafruit_NeoPixel strip2 = Adafruit_NeoPixel(4, 6, NEO_GRB + NEO_KHZ800);     //날씨 LED_번개
Adafruit_NeoPixel strip3 = Adafruit_NeoPixel(4, 9, NEO_GRB + NEO_KHZ800);     //날씨 LED_눈

const unsigned long postingInterval = 20L * 1000L; //interval 시간
int weather = 0;
String inString = "";

void setup() {
  //각 변수에 정해진 공간 할당
  Serial.begin(115200);

  //LED strip
  strip.begin();
  strip1.begin();
  strip2.begin();
  strip3.begin();
  colorWipe(strip.Color(255, 255, 255), 50); //배경 LED on
  strip1.show();

  delay(10);
 
}
//rain = 0, lightning = 1, snow = 2,
void loop() {
  // Read serial input:
  while (Serial.available() > 0) {
    int inChar = Serial.read();
    if (isDigit(inChar)) {
      // convert the incoming byte to a char and add it to the string:
      inString += (char)inChar;
    }
    // if you get a newline, print the string, then the string's value:
    if (inChar == '\n') {
      weather = inString.toInt();
      inString = "";
    }
  }
 
  if (weather == 0) {//rain
    colorWipe(strip.Color(0, 0, 255), 50);
    colorWipe1(strip1.Color(0, 0, 255), 50);
    colorWipe2(strip2.Color(0, 0, 0), 50);
    colorWipe3(strip3.Color(0, 0, 0), 50);
  }

  else if (weather == 1) {//lighting
    colorWipe(strip.Color(255, 255, 255), 50);
    colorWipe1(strip1.Color(0, 0, 0), 50);
    theaterChase2(strip2.Color(255, 150, 0), 50);
    //colorWipe2(strip2.Color(255, 150, 0), 50);
    colorWipe3(strip3.Color(0, 0, 0), 50);
  }

  else if (weather == 2) {//snow
    colorWipe(strip.Color(100, 155, 255), 50);
    colorWipe1(strip1.Color(0, 0, 0), 50);
    colorWipe2(strip2.Color(0, 0, 0), 50);
    colorWipe3(strip3.Color(100, 155, 255), 50);
  }
  else {
    colorWipe(strip.Color(255, 255, 255), 50);
    colorWipe1(strip1.Color(0, 0, 0), 50);
    colorWipe2(strip2.Color(0, 0, 0), 50);
    colorWipe3(strip3.Color(0, 0, 0), 50);
  }
}

 

///////////////////////////function LED strip/////////////////////////////////

void colorWipe(uint32_t c, uint8_t wait) {
  for (uint16_t i = 0; i < strip.numPixels)(; i++) {
    strip.setPixelColor(i, c);
    strip.show();
    delay(wait);
  }
}

void colorWipe1(uint32_t c, uint8_t wait) {
  for (uint16_t i = 0; i < strip1.numPixels(); i++) {
    strip1.setPixelColor(i, c);
    strip1.show();
    delay(wait);
  }
}

void colorWipe2(uint32_t c, uint8_t wait) {
  for (uint16_t i = 0; i < strip2.numPixels(); i++) {
    strip2.setPixelColor(i, c);
    strip2.show();
    delay(wait);
  }
}

void theaterChase2(uint32_t c, uint8_t wait) {
  for (int j = 0; j < 10; j++) { //do 10 cycles of chasing
    for (int q = 0; q < 3; q++) {
      for (int i = 0; i < strip2.numPixels(); i = i + 3) {
        strip2.setPixelColor(i + q, c);  //turn every third pixel on
      }
      strip.show();

      delay(wait);

      for (int i = 0; i < strip2.numPixels(); i = i + 3) {
        strip2.setPixelColor(i + q, 0);      //turn every third pixel off
      }
    }
  }
}

void colorWipe3(uint32_t c, uint8_t wait) {
  for (uint16_t i = 0; i < strip3.numPixels(); i++) {
    strip3.setPixelColor(i, c);
    strip3.show();
    delay(wait);
  }
}

이전글   |    아두이노 우노 I2C 핀 질문이 있습니다! 2018-06-18
다음글   |    시리얼 모니터에 출력한 값을 다시 읽어오기... 2018-06-19