ArduinoSketch
#include <virtuabotixRTC.h> //|
#include <Servo.h>
// Creation of the Real Time Clock Object
virtuabotixRTC myRTC(6, 7, 8);
int heure,minutes,secondes,angle;
int max_count_Normal = 83 ;
int count=0;
int leds=11;
int button=5;
Servo Aiguille;
unsigned int heures,value;
void setup() {
Serial.begin(9600);
pinMode(leds,OUTPUT);
myRTC.setDS1302Time(50, 59, 23, 6, 10, 1, 2014);
Aiguille.attach(10);
}
byte Flicker_table[] = { 20, 20, 30, 40, 30, 30, 40, 50, 60, 70, 80, 70, 70, // the table that tells us how to flicker
60, 60, 50, 50, 50, 60, 70, 80, 90, 100, 120,140,160,
240,250,100,150,250,250,250,250,250,250, 140,
240,230,220,100, 80,70,70, 70, 80, 80,
140,130,120,110,200,210,220,220,100,90,60,
40, 30, 30, 40, 30, 20, 20,40,50,90,150,80,120,110,140,160,250,150,130,110,80,60,20 };
void loop() {
myRTC.updateTime();
if(myRTC.hours>=12)
{
heure=(myRTC.hours-12);
}
else
{
heure=myRTC.hours;
}
heures=heure*3600;
minutes=myRTC.minutes*60;
secondes=myRTC.seconds;
value=heures+minutes+secondes;
angle=map(value,0,43199,179,5);
Serial.println(angle);
Aiguille.write(angle);
// Delay so the program doesn't print non-stop
delay(50);
analogWrite(leds, Flicker_table[count]); // Runs through the Norm_Glow_table
count++; // We stay in this loop till the switch is activaled
if(count > max_count_Normal )
count = 0;
}
Public Last updated: 2018-08-12 11:50:38 AM