can somebody combine this two program for me ?

my first sketch
is

#include <DS3231.h>
#include <Servo.h>
#include <LiquidCrystal.h>
#include <Keypad.h>
#include <SoftwareSerial.h>
const byte ROWS = 4; // Four rows
const byte COLS = 4; // Three

// Define the Keymap

char keys[ROWS][COLS] = {

{'1','2','3'},

{'4','5','6'},

{'7','8','9'},

{'*','0','#'}

};

// Connect keypad ROW0, ROW1, ROW2 and ROW3 to these Arduino pins.

byte rowPins[ROWS] = { 0, 2, 3, 4 };

// Connect keypad COL0, COL1 and COL2 to these Arduino pins.

byte colPins[COLS] = { 5, 6, 7 };

// Create the Keypad
Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

DS3231 rtc(A4, A5);
Servo servo_test; //initialize a servo object for the connected servo
LiquidCrystal lcd(A0, A1, A2, 8, 12, 13); // Creates an LC object. Parameters: (rs, enable, d4, d5, d6, d7)

//int angle = 0;

// int potentio = A0; // initialize the A0analog pin for potentiometer
int t1, t2, t3, t4, t5, t6;

boolean feed = true; // condition for alarm

char key;
int r[6];

void setup()
{
servo_test.attach(9); // attach the signal pin of servo to pin9 of arduino
rtc.begin();
lcd.begin(16,2);
servo_test.write(55);
Serial.begin(9600);
pinMode(A0, OUTPUT);
pinMode(A1, OUTPUT);
pinMode(A2, OUTPUT);

}

void loop()
{

lcd.setCursor(0,0);
int buttonPress;
buttonPress = digitalRead(A3);

if (buttonPress==1)
setFeedingTime();

//Serial.println(buttonPress);

lcd.print("Time: ");
String t = "";
t = rtc.getTimeStr();
t1 = t.charAt(0)-48;
t2 = t.charAt(1)-48;
t3 = t.charAt(3)-48;
t4 = t.charAt(4)-48;
t5 = t.charAt(6)-48;
t6 = t.charAt(7)-48;

lcd.print(rtc.getTimeStr());
lcd.setCursor(0,1);
lcd.print("Date: ");
lcd.print(rtc.getDateStr());

if (t1==r[0] && t2==r[1] && t3==r[2] && t4==r[3]&& t5<1 && t6<3 && feed==true)
{

servo_test.write(220); //command to rotate the servo to the specified angle
delay(8000);
servo_test.write(75);
feed=false;

}
}

void setFeedingTime()
{
feed = true;
int i=0;

lcd.clear();
lcd.setCursor(0,0);
lcd.print("Set feeding Time");
lcd.clear();
lcd.print("HH:MM");
lcd.setCursor(0,1);

while(1){
key = kpd.getKey();

char j;

if(key!=NO_KEY){

lcd.setCursor(j,1);

lcd.print(key);

r = key-48;

  • i++;*
  • j++;*
  • if (j==2)*
  • {*
  • lcd.print(":"); j++;*
  • }*
  • delay(500);*
  • }*
  • if (key == '#')*
  • {key=0; break; }*
  • }*
    }
    and my second scetch is
    #include <SoftwareSerial.h> // TX RX software library for bluetooth
    #include <Servo.h> // servo library
    Servo myservo; // servo name
    int bluetoothTx = 10; // bluetooth tx to 10 pin
    int bluetoothRx = 11; // bluetooth rx to 11 pin
    SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);
    void setup()
    {
  • myservo.attach(9); // attach servo signal wire to pin 9*
  • //Setup usb serial connection to computer*
  • Serial.begin(9600);*
    //Setup Bluetooth serial connection to android
  • bluetooth.begin(9600);*
    }
    void loop()
    {
  • //Read from bluetooth and write to usb serial*
  • if(bluetooth.available()> 0 ) // receive number from bluetooth*
  • {*
  • int servopos = bluetooth.read(); // save the received number to servopos*
  • Serial.println(servopos); // serial print servopos current number received from bluetooth*
  • myservo.write(servopos); // roate the servo the angle received from the android app*
  • }*
    }

May be someone can also read the forum rules for you ?...

3 times you have asked this question, 3 times people instructed you to follow forum rules. 3 times you refused and continue not to follow guidelines.

You have been working on this for some time, so far all three times the code you posted was the same, with no attempt to do the work yourself. This signals a lazy programmer who wants the work done for them. I suggest you have this post moved to GIG's and you can hire someone to write your code.

Try this. Non-duplicated parts of pre-setup code are put before setup(), non-duplicate parts of setup code are put in setup(), and non-duplicate parts of loop code are put in loop().

I can't compile without all the libraries called out

#include <DS3231.h>
#include <Servo.h>
#include <LiquidCrystal.h>
#include <Keypad.h>
#include <SoftwareSerial.h>


const byte ROWS = 4; // Four rows
const byte COLS = 4; // Three 




// Define the Keymap


char keys[ROWS][COLS] = {


  {
    '1','2','3'  }
  ,


  {
    '4','5','6'  }
  ,


  {
    '7','8','9'  }
  ,


  {
    '*','0','#'  }


};




// Connect keypad ROW0, ROW1, ROW2 and ROW3 to these Arduino pins.


byte rowPins[ROWS] = { 
  0, 2, 3, 4 };


// Connect keypad COL0, COL1 and COL2 to these Arduino pins.


byte colPins[COLS] = { 
  5, 6, 7 };


//  Create the Keypad
Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );




DS3231  rtc(A4, A5);
Servo servo_test;      //initialize a servo object for the connected servo  
LiquidCrystal lcd(A0, A1, A2, 8, 12, 13); // Creates an LC object. Parameters: (rs, enable, d4, d5, d6, d7)


//int angle = 0;    


// int potentio = A0;      // initialize the A0analog pin for potentiometer
int t1, t2, t3, t4, t5, t6;




boolean feed = true; // condition for alarm


char key;
int r[6];




Servo myservo; // servo name
int bluetoothTx = 10; // bluetooth tx to 10 pin
int bluetoothRx = 11; // bluetooth rx to 11 pin
SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);


void setup() 
{ 
  servo_test.attach(9);   // attach the signal pin of servo to pin9 of arduino
  rtc.begin();
  lcd.begin(16,2);
  servo_test.write(55);   
  Serial.begin(9600);
  pinMode(A0, OUTPUT);
  pinMode(A1, OUTPUT);
  pinMode(A2, OUTPUT);


  //Setup Bluetooth serial connection to android
  bluetooth.begin(9600);
} 


void loop() 
{ 


  lcd.setCursor(0,0);
  int buttonPress;
  buttonPress = digitalRead(A3);


  if (buttonPress==1)
    setFeedingTime();




  //Serial.println(buttonPress);


  lcd.print("Time:  ");
  String t = "";
  t = rtc.getTimeStr(); 
  t1 = t.charAt(0)-48;
  t2 = t.charAt(1)-48;
  t3 = t.charAt(3)-48;
  t4 = t.charAt(4)-48;
  t5 = t.charAt(6)-48;
  t6 = t.charAt(7)-48;


  lcd.print(rtc.getTimeStr());
  lcd.setCursor(0,1);
  lcd.print("Date: ");
  lcd.print(rtc.getDateStr());


  if (t1==r[0] && t2==r[1] && t3==r[2] && t4==r[3]&& t5<1 && t6<3 && feed==true)
  { 


    servo_test.write(220);                   //command to rotate the servo to the specified angle 
    delay(8000);   
    servo_test.write(75); 
    feed=false;


  } 
}       


void setFeedingTime()
{
  feed = true;
  int i=0;


  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("Set feeding Time");
  lcd.clear();
  lcd.print("HH:MM");
  lcd.setCursor(0,1);




  while(1){
    key = kpd.getKey();


    char j;


    if(key!=NO_KEY){


      lcd.setCursor(j,1);


      lcd.print(key);


      r = key-48;
      i++;
      j++;


      if (j==2)
      {
        lcd.print(":"); 
        j++;
      }
      delay(500);
    }


    if (key == '#')
    {
      key=0; 
      break; 
    }
  }


  //Read from bluetooth and write to usb serial
  if(bluetooth.available()> 0 ) // receive number from bluetooth
  {
    int servopos = bluetooth.read(); // save the received number to servopos
    Serial.println(servopos); // serial print servopos current number received from bluetooth
    myservo.write(servopos); // roate the servo the angle received from the android app
  }
}

Romonaga:
3 times you have asked this question, 3 times people instructed you to follow forum rules. 3 times you refused and continue not to follow guidelines.

Previous posts removed.

The easy way that works with most sketches:

void setup()
{
  setup1();
  setup2();
}


void loop()
{
  loop1();
  loop2();
}


// my first sketch is
#include <DS3231.h>
#include <Servo.h>
#include <LiquidCrystal.h>
#include <Keypad.h>
#include <SoftwareSerial.h>


const byte ROWS = 4; // Four rows
const byte COLS = 4; // Three


// Define the Keymap


char keys[ROWS][COLS] = {
  {'1', '2', '3'},
  {'4', '5', '6'},
  {'7', '8', '9'},
  {'*', '0', '#'}
};

// Connect keypad ROW0, ROW1, ROW2 and ROW3 to these Arduino pins.
byte rowPins[ROWS] = { 0, 2, 3, 4 };


// Connect keypad COL0, COL1 and COL2 to these Arduino pins.
byte colPins[COLS] = { 5, 6, 7 };


//  Create the Keypad
Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

DS3231  rtc(A4, A5);
Servo servo_test;      //initialize a servo object for the connected servo
LiquidCrystal lcd(A0, A1, A2, 8, 12, 13); // Creates an LC object. Parameters: (rs, enable, d4, d5, d6, d7)


//int angle = 0;


// int potentio = A0;      // initialize the A0analog pin for potentiometer
int t1, t2, t3, t4, t5, t6;

boolean feed = true; // condition for alarm


char key;
int r[6];


void setup1()
{
  servo_test.attach(9);   // attach the signal pin of servo to pin9 of arduino
  rtc.begin();
  lcd.begin(16, 2);
  servo_test.write(55);
  Serial.begin(9600);
  pinMode(A0, OUTPUT);
  pinMode(A1, OUTPUT);
  pinMode(A2, OUTPUT);
}


void loop1()
{
  lcd.setCursor(0, 0);
  int buttonPress;
  buttonPress = digitalRead(A3);


  if (buttonPress == 1)
    setFeedingTime();

  //Serial.println(buttonPress);


  lcd.print("Time:  ");
  String t = "";
  t = rtc.getTimeStr();
  t1 = t.charAt(0) - 48;
  t2 = t.charAt(1) - 48;
  t3 = t.charAt(3) - 48;
  t4 = t.charAt(4) - 48;
  t5 = t.charAt(6) - 48;
  t6 = t.charAt(7) - 48;


  lcd.print(rtc.getTimeStr());
  lcd.setCursor(0, 1);
  lcd.print("Date: ");
  lcd.print(rtc.getDateStr());


  if (t1 == r[0] && t2 == r[1] && t3 == r[2] && t4 == r[3] && t5 < 1 && t6 < 3 && feed == true)
  {
    servo_test.write(220);                   //command to rotate the servo to the specified angle
    delay(8000);
    servo_test.write(75);
    feed = false;
  }
}


void setFeedingTime()
{
  feed = true;
  int i = 0;


  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Set feeding Time");
  lcd.clear();
  lcd.print("HH:MM");
  lcd.setCursor(0, 1);

  while (1) {
    key = kpd.getKey();


    char j;


    if (key != NO_KEY) {
      lcd.setCursor(j, 1);


      lcd.print(key);


      r[i] = key - 48;
      i++;
      j++;


      if (j == 2)
      {
        lcd.print(":"); j++;
      }
      delay(500);
    }


    if (key == '#')
    {
      key = 0;
      break;
    }
  }
}

// and my second scetch is
#include <SoftwareSerial.h> // TX RX software library for bluetooth
#include <Servo.h> // servo library 
Servo myservo; // servo name
int bluetoothTx = 10; // bluetooth tx to 10 pin
int bluetoothRx = 11; // bluetooth rx to 11 pin
SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);

void setup2()
{
  myservo.attach(9); // attach servo signal wire to pin 9
  //Setup usb serial connection to computer
  Serial.begin(9600);
  //Setup Bluetooth serial connection to android
  bluetooth.begin(9600);
}


void loop2()
{
  //Read from bluetooth and write to usb serial
  if (bluetooth.available() > 0 ) // receive number from bluetooth
  {
    int servopos = bluetooth.read(); // save the received number to servopos
    Serial.println(servopos); // serial print servopos current number received from bluetooth
    myservo.write(servopos); // roate the servo the angle received from the android app
  }
}

can somebody combine this two program for me ?

Without knowing what YOU expect the resulting program to do? Not a snowball's chance in hell.

Hi,

Read this before posting a programming question ...

How to use this forum - please read.

I have a washing machine and a refrigerator. Can somebody combine them for me?

PaulMurrayCbr:
I have a washing machine and a refrigerator. Can somebody combine them for me?

You bet. The result will be an outboard motor.

PaulMurrayCbr:
I have a washing machine and a refrigerator. Can somebody combine them for me?

Yeah, no problem. The outcome will be the stuff they are using to mix ice cream in those barrels and also freeze it a little, are u satisfied with it? :smiley:

PaulMurrayCbr:
I have a washing machine and a refrigerator. Can somebody combine them for me?

It'll be a cryogenic centrifuge.