#include "print.h"
#include "string.h"
#include "etherShield.h"
#include "stdio.h"
#include "Time.h"
#include "EEPROM.h"
#include "param.h"
time_t prevDisplay = 0; // when the digital clock was displayed
#include "teleinfo.h"
#include "log.h"
#include "serveur_web.h"
#include "ntp.h"
char power;
char index;
void setup()
{
init_ethernet();
Serial.begin(1200);
// parite paire E
// 7 bits data
UCSR0C = B00100100;
///////////////////////////////////////////////////////////////////////////
// Avec cette commande serial monitor ne fonctionne pas normalement!
// il faut etablir une liaison avec hyperterminal
// attention l'uploading necessite de déconnecter la pin0 Rx
////////////////////////////////////////////////////////////////////////////
setSyncInterval(interval_synchro);
setSyncProvider( client_process_NTP); //set function to call when sync required
////////////////////////////////////////////////////////////////////////////////////////////////////
//Taille des piles d'enregistrement mémoire Max 1024 Bits
///////////////////////////////////////////////////////////////////////////////////////////////////
test_init_pile ( 30, 500, 60, 1); // init de la pile (Offset, longueur, Intervall temps, N°pile)
test_init_pile (540, 450, 1800, 0); // init de la pile (Offset, longueur, Intervall temps, N°pile)
}
void loop()
{
web_server();
read_teleinfo();
// display heure
if( now() != prevDisplay) //update the display only if the time has changed
{
power=papp/40;
Write_log( now(), power, 1); // Ecriture pile Puissnce
if (ptec[1]=='C') index = (hchc/1000)%250; // Sauve Index Heure Creuse
else index = (hchp/1000)%250; // Sauve Index Heure Creuse
Write_log( now(), index, 0); // Ecriture Pile Index Kw/h
prevDisplay = now();
// digitalClockDisplay();
}
}
//*****************************************************************************************
//
// Function : Affichage liaison serie
//
//*****************************************************************************************
void digitalClockDisplay(){
// digital clock display of the time
Serial.print(hour());
printDigits(minute());
printDigits(second());
Serial.print(" ");
Serial.print(day());
Serial.print(" ");
Serial.print(month());
Serial.print(" ");
Serial.print(year());
Serial.println();
}
void printDigits(int digits){
// utility function for digital clock display: prints preceding colon and leading 0
Serial.print(":");
if(digits < 10)
Serial.print('0');
Serial.print(digits);
}
************le .pde