i tried to make a fish feeder code and everything works well except for the motor that should turn a wheel to spit out food, on the code it is a normal servo but i am using a continous rotation servo. can someone please help me figure out how to implement the 360 servo in place of the two normal servo codes ( the first one will center the servo which may be unneccisary idk) (the second one will turn the wheel a few degrees) i took out the oled display bitmap becuase it took up too much space.
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include "ABlocks_DS3231rtc.h"
#include <Servo.h>
Adafruit_SSD1306 oled_1(128,64, &Wire,-1);
DS3231rtc rtc;
Servo servo_9;
static const uint8_t PROGMEM oled_data_0[] PROGMEM = { BITMAP IMAGE GOES HERE };
String rtc_time_text(){
char rtcbuffer[10];
sprintf(rtcbuffer,"%02d:%02d:%02d", rtc.getHour(), rtc.getMinute(), rtc.getSecond() );
return String(rtcbuffer);
}
void fish_food_left() {
oled_1.clearDisplay(); oled_1.drawBitmap(0,0,&oled_data_2[2],oled_data_2[0], oled_data_2[1],WHITE); oled_1.display();
}
void fish_food_right() {
oled_1.clearDisplay(); oled_1.drawBitmap(0,0,&oled_data_3[2],oled_data_3[0], oled_data_3[1],WHITE); oled_1.display();
}
void setup()
{
oled_1.begin(SSD1306_SWITCHCAPVCC,0x3C);
rtc.begin();
servo_9.attach(9);
servo_8.attach(8);
rtc.setTime(0,0,0,0,0,19);
servo_9.write(0);
delay(1000);
}
void loop()
{
oled_1.clearDisplay(); oled_1.drawBitmap(0,0,&oled_data_0[2],oled_data_0[0], oled_data_0[1],WHITE); oled_1.display();
oled_1.setTextSize(1); oled_1.setTextColor(WHITE); oled_1.setCursor(0,5); oled_1.print(rtc_time_text()); oled_1.display();
delay(1000);
if((millis()-task_time_ms)>=10000){
task_time_ms=millis();
oled_1.clearDisplay(); oled_1.drawBitmap(0,0,&oled_data_1[2],oled_data_1[0], oled_data_1[1],WHITE); oled_1.display();
rtc.setTime(0,0,0,0,0,19);
servo_8.write(30);
delay(1000);
}
}