Arduino水泵控制程序编译错误


#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一起使用。

最新更新