이번에 스마트팜 키트를 샀는데 

제공해준 아두이노 스케치가 계속 오류가 나 ㅠㅠ 판매자는 답변도 없고 이거 어떻게 수정해야 돼요..?

일단 오류는 Serial1이 선언이 안되었다고 뜨긴하는데.. 내가 완전 코딩알못이라..

Serial1.write(line); 오류 뜨느 줄이에요

 




#include <Wire.h>

#include <LiquidCrystal_I2C.h>

#include <DHT.h>


#define DHTTYPE DHT11

#define DHTPIN 12

#define MOTOR 32

#define VR A4

#define LED 23


LiquidCrystal_I2C lcd(0x27, 16, 2);

DHT dht(DHTPIN, DHTTYPE);


char line[33];

boolean motor_mode_auto = 1;

byte motor_onoff = 0;

float temp =0, hum = 0 ;

float cor_hum = 0; 

int display_toggle = 0;

float dis = 0; 

float cor = 0; 

int VR_temp = 0, VR_old =0 ;


int request_dht11(){

  int err;

  hum = dht.readHumidity();

  temp = dht.readTemperature();

  Serial.print(hum);

  Serial.print(',');

  Serial.print(temp);

  return err;

}

  

void setup() {

  pinMode(MOTOR, OUTPUT);

  pinMode(LED, OUTPUT);

  Serial1.begin(9600);

  lcd.clear();   

  lcd.init();  

  lcd.backlight(); 

  dht.begin();

  Serial.begin(9600);

 }


void MOTOR_Control_OnOff(byte onoff)

{

  motor_onoff = onoff;

    if(onoff == 1) {

    digitalWrite(MOTOR, HIGH);

digitalWrite(LED, HIGH);

    }

  else {

    digitalWrite(MOTOR, LOW);

digitalWrite(LED,LOW);

  }

}


void Set_VR_Temp(void){

  int VR_adc = analogRead(VR); // 0 ~ 1023 -> 20~40

  VR_temp = 20 + (VR_adc * 20 / 1023);

  

   if(VR_temp != VR_old){

    motor_mode_auto = 1;

   }

  VR_old = VR_temp;

 }


void loop() {

   request_dht11();

 

  display_toggle += 1;

  if(display_toggle % 10 < 5) {

  sprintf(line, "HUM: %02d %%   %s", (int)hum, 

  motor_mode_auto ? "AUTO" : "USER");

  lcd.setCursor(0, 0);

  lcd.print(line);


  sprintf(line, "TEM: %02d %02dC %s", (int)temp,

  VR_temp, motor_onoff ? "ON  " : "OFF ");

  lcd.setCursor(0, 1);

  lcd.print(line);

 }


  Set_VR_Temp();

   if(motor_mode_auto == 1) {

    if(VR_temp < temp) {

      MOTOR_Control_OnOff(1);

    }

    else {

      MOTOR_Control_OnOff(0);

    }


  

   dis = (9/5)* temp - 0.55 * (1-hum/100)*

   ((9/5)*temp-26)+32;

  

  if(hum< 66) cor_hum = 66;

  cor = (((cor_hum-65)/14)*pow(1.054, temp));

    

  }

    

   if(display_toggle % 10 >= 5) {

  sprintf(line, "DIS: %02d.%02d  %s", (int)dis, 

  (int)(dis*100)%100, motor_mode_auto ? "AUTO" : "USER");

  lcd.setCursor(0, 0);

  lcd.print(line);


  sprintf(line, "COR: %02d.%02d  %s", (int)cor, 

  (int)(cor*100)%100, motor_onoff ? "ON  " : "OFF ");

  lcd.setCursor(0, 1);

  lcd.print(line);   

}


  sprintf(line, "HUM: %02d%% TEM: %02d'C AUTO=%d MOTOR=%d\r\n",

  (int)hum,(int)temp, motor_mode_auto, motor_onoff);

  Serial1.write(line);


  if(Serial1.available()) {

    char c = Serial1.read();

    if(c == 'm') {

      motor_mode_auto = 0;

      MOTOR_Control_OnOff(1);

    }

    else if(c == 's') {

      motor_mode_auto = 0;

      MOTOR_Control_OnOff(0);

    }

    else if(c == 'a') {

      motor_mode_auto = 1;

    }    

  

   }

  delay(700);

}