first commit
This commit is contained in:
137
SOLAIRE_TRACKER/SOLAIRE_TRACKER.ino
Normal file
137
SOLAIRE_TRACKER/SOLAIRE_TRACKER.ino
Normal file
@@ -0,0 +1,137 @@
|
||||
#include "Date_heure.h"
|
||||
#include "ephemeride.h"
|
||||
|
||||
// Load the virtuabotixRTC library
|
||||
//#include "virtuabotixRTC.h"
|
||||
|
||||
// Determine the pins connected to the module
|
||||
// myRTC (clock, data, RST)
|
||||
//virtuabotixRTC myRTC (6, 7, 8);
|
||||
int PWMA=5;//Right side
|
||||
int PWMB=4;//Left side
|
||||
int DA=0;//Right reverse
|
||||
int DB=2;//Left reverse
|
||||
|
||||
void setup() {
|
||||
// initialize digital pin LED_BUILTIN as an output.
|
||||
Serial.begin(9600);
|
||||
pinMode(PWMA, OUTPUT);
|
||||
pinMode(PWMB, OUTPUT);
|
||||
pinMode(DA, OUTPUT);
|
||||
pinMode(DB, OUTPUT);
|
||||
stop();
|
||||
// After to set the entire information, comment the following line
|
||||
// (seconds, minutes, hours, day of week, day of month, month, year)
|
||||
// myRTC.setDS1302Time (0, 18, 23, 6, 31, 7, 2021);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
||||
// Reads the information from the CI
|
||||
// myRTC.updateTime ();
|
||||
// printTime();
|
||||
//
|
||||
// Serial.print("rang=");
|
||||
// int N = rangJour(myRTC.dayofmonth,myRTC.month,myRTC.year);
|
||||
// Serial.println(N);
|
||||
//
|
||||
// Serial.print("declinaison=");
|
||||
// Serial.println(declinaisonSolaire(N));
|
||||
//
|
||||
//
|
||||
// Serial.print("angleHoraireSoeil=");
|
||||
// Serial.println(angleHoraireSoeil(N, 47.728));
|
||||
|
||||
avance();
|
||||
delay(10000); // wait for a second
|
||||
Serial.println("off");
|
||||
recule();
|
||||
delay(10000); // wait for a second
|
||||
Serial.println("On");
|
||||
|
||||
stop();
|
||||
delay(10000);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void printTime()
|
||||
{
|
||||
// Print the details in serial monitor
|
||||
// Serial.print
|
||||
// ("Data "); // Call the routine that prints the day of the week
|
||||
// imprime_dia_da_semana (myRTC.dayofweek);
|
||||
// Serial.print (", ");
|
||||
// Serial.print (myRTC.dayofmonth);
|
||||
// Serial.print ("/");
|
||||
// Serial.print (myRTC.month);
|
||||
// Serial.print ("/");
|
||||
// Serial.print (myRTC.year);
|
||||
// Serial.print ("");
|
||||
// Serial.print
|
||||
// (" Time "); // Adds a 0 if the time value is <10
|
||||
// if (myRTC.hours <10)
|
||||
// {
|
||||
// Serial.print ("0");
|
||||
// }
|
||||
// Serial.print (myRTC.hours);
|
||||
// Serial.print
|
||||
// (":"); // Adds a 0 if the value of the minutes is <10
|
||||
// if (myRTC.minutes <10)
|
||||
// {
|
||||
// Serial.print ("0");
|
||||
// }
|
||||
// Serial.print (myRTC.minutes);
|
||||
// Serial.print
|
||||
// (":"); // Adds a 0 if the value of the latter is <10
|
||||
// if (myRTC.seconds <10)
|
||||
// {
|
||||
// Serial.print ("0");
|
||||
// }
|
||||
// Serial.println (myRTC.seconds);
|
||||
|
||||
}
|
||||
void stop()
|
||||
{
|
||||
digitalWrite(PWMA, LOW); // turn the LED on (HIGH is the voltage level)
|
||||
digitalWrite(DA, LOW);
|
||||
}
|
||||
|
||||
void avance() {
|
||||
digitalWrite(PWMA, HIGH); // turn the LED on (HIGH is the voltage level)
|
||||
digitalWrite(DA, HIGH);
|
||||
}
|
||||
|
||||
void recule() {
|
||||
digitalWrite(PWMA, HIGH);
|
||||
|
||||
digitalWrite(DA, LOW); // turn the LED on (HIGH is the voltage level)
|
||||
}
|
||||
|
||||
void imprime_dia_da_semana (int day)
|
||||
{
|
||||
switch (day)
|
||||
{
|
||||
case 1:
|
||||
Serial.print
|
||||
("Sunday");
|
||||
break; case 2:
|
||||
Serial.print
|
||||
("Second");
|
||||
break; case 3:
|
||||
Serial.print
|
||||
("Terca");
|
||||
break; case 4:
|
||||
Serial.print
|
||||
("Wednesday");
|
||||
break; case 5:
|
||||
Serial.print
|
||||
("Quinta");
|
||||
break; case 6:
|
||||
Serial.print
|
||||
("Friday");
|
||||
break; case 7:
|
||||
Serial.print
|
||||
("Saturday"); break;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user