簡體   English   中英

Arduino水泵控制程序編譯錯誤

[英]Compilation error in Arduino water pump control program

#include <Adafruit_EEPROM_I2C.h>
#include <Adafruit_FRAM_I2C.h>
#include <Servo.h> 
#include <Wire.h> 
#include "RTClib.h" 

RTC_DS3231 rtc; // create an instance of the RTC object
Servo myservo; // create an instance of the Servo object

const int servoPin = 9; // define the pin for the servo motor
const int pumpPin = 8; // define the pin for the DC water pump

void setup() {
  Serial.begin(9600); // start the serial connection
  myservo.attach(servoPin); // attach the servo to the servo pin
  pinMode(pumpPin, OUTPUT); // set the pump pin as an output
  Wire.begin(); // start the I2C communication
  rtc.begin(); // start the RTC
}

void loop() {
  DateTime now = rtc.now(); // get the current time from the RTC

  // check if it is 7:00 or 12:00
  if (now.hour() == 7 || now.hour() == 12) {
    // move the servo to the "on" position
    myservo.write(0); 
    delay(2000); // wait for 2 seconds
    // turn on the DC water pump
    digitalWrite(pumpPin, HIGH);
    delay(10000); // wait for 10 seconds
    // turn off the DC water pump
    digitalWrite(pumpPin, LOW);
    // move the servo to the "off" position
    myservo.write(180);
  }

  delay(1000); // wait for 1 second before checking the time again
}

那是我的程序,但是當我嘗試編譯它時,錯誤顯示為#include <Adafruit_I2CDevice.h> Error compiling for board Arduino Uno 誰能幫幫我嗎? 我只是一個初學者。

刪除前兩行,這些:

#include <Adafruit_EEPROM_I2C.h>
#include <Adafruit_FRAM_I2C.h>

您不會在您的程序中使用這些庫,據我所知,它們不適用於 Arduino Uno。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM