bon y a du neuf !!
la j'ai fait un mini programme avec juste les deux et effectivement sa fonctionne...
ce qui veut dire que c'est dans mon big programme que sa bug...
bon ba.. le voila:
#include <SPI.h>
#include <Ethernet.h>
#include <SoftwareSerial.h>
#include <EthernetUdp.h>
#include <string.h>
const int cs=8; //chip select
SoftwareSerial portOne(2, 3);
EthernetUDP Udp;
int time_preset_1[6],time_preset_2[6],time_preset_3[6],time_preset_4[6],time_preset_5[6],time_preset_6[6],time_preset_7[6],time_preset_8[6],time_preset_9[6];
int ronde_active=0;
int time_of_ronde=0;
int switch_ronde=1;
int ID_ronde=1;
int ID_dome=1;
int ID_arduino=1;
int heur_rond1_s,heur_rond2_s,heur_rond3_s,heur_rond4_s,heur_rond5_s,heur_rond1_f,heur_rond2_f,heur_rond3_f,heur_rond4_f,heur_rond5_f;
int min_rond1_s,min_rond2_s,min_rond3_s,min_rond4_s,min_rond5_s,min_rond1_f,min_rond2_f,min_rond3_f,min_rond4_f,min_rond5_f;
int temperature_analogique=0;
int ecriture=0;
int tension_can=0;
float tension=0;
boolean ronde1_chrono=0,ronde2_chrono=0,ronde3_chrono=0,ronde4_chrono=0,ronde5_chrono=0;
boolean fin_tempo=1;
char h_start_ronde1[6],h_start_ronde2[6],h_start_ronde3[6],h_start_ronde4[6],h_start_ronde5[6];
char h_fin_ronde1[6],h_fin_ronde2[6],h_fin_ronde3[6],h_fin_ronde4[6],h_fin_ronde5[6];
char temperature[25];
float temp=0;
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xCC };
byte broadcast[] = { 255, 255, 255, 255};
byte trame_ronde[7];
byte reception[16];
byte rcv_pupitre[7];
unsigned int localPort = 1234;
unsigned long time1,time2,temp_act=0,temp_prec=0;
void setup()
{
Ethernet.begin(mac);
portOne.begin(2400);
Udp.begin(localPort);
Serial.begin(2400); // DEBUG
RTC_init();
}
void loop() {
Serial.println(ReadTimeDate());
delay(500);
int packetSize = Udp.parsePacket();
if(packetSize)
{
Udp.read(reception,sizeof(reception));
if ((reception[0]==0x11) && (reception[1]==0x22) && (reception[2]==0x33))
{
ID_dome=(reception[3]<<24)+((reception[4]& 0xFF)<<16)+((reception[5]& 0xFF)<<8)+(reception[6]& 0xFF);
if (ID_dome!=ID_arduino){ }
else
{
ID_ronde=((reception[7])<<24)+((reception[8]& 0xFF)<<16)+((reception[9]& 0xFF)<<8)+(reception[10]& 0xFF);
ronde_active=boolean(reception[11]);
time_preset_1[ID_ronde]=(reception[12]<<24)+((reception[13]& 0xFF)<<16)+((reception[14]& 0xFF)<<8)+(reception[15]& 0xFF);
memset(reception, 0x00, sizeof(reception));
delay(15);
Udp.read(reception,sizeof(reception));
time_preset_2[ID_ronde]=(reception[4]<<24)+((reception[5]& 0xFF)<<16)+((reception[6]& 0xFF)<<8)+(reception[7]& 0xFF);
time_preset_3[ID_ronde]=(reception[8]<<24)+((reception[9]& 0xFF)<<16)+((reception[10]& 0xFF)<<8)+(reception[11]& 0xFF);
time_preset_4[ID_ronde]=(reception[12]<<24)+((reception[13]& 0xFF)<<16)+((reception[14]& 0xFF)<<8)+(reception[15]& 0xFF);
memset(reception, 0x00, sizeof(reception));
delay(15);
Udp.read(reception,sizeof(reception));
time_preset_5[ID_ronde]=(reception[4]<<24)+((reception[5]& 0xFF)<<16)+((reception[6]& 0xFF)<<8)+(reception[7]& 0xFF);
time_preset_6[ID_ronde]=(reception[8]<<24)+((reception[9]& 0xFF)<<16)+((reception[10]& 0xFF)<<8)+(reception[11]& 0xFF);
time_preset_7[ID_ronde]=(reception[12]<<24)+((reception[13]& 0xFF)<<16)+((reception[14]& 0xFF)<<8)+(reception[15]& 0xFF);
memset(reception, 0x00, sizeof(reception));
delay(15);
Udp.read(reception,sizeof(reception));
time_preset_8[ID_ronde]=(reception[4]<<24)+((reception[5]& 0xFF)<<16)+((reception[6]& 0xFF)<<8)+(reception[7]& 0xFF);
time_preset_9[ID_ronde]=(reception[8]<<24)+((reception[9]& 0xFF)<<16)+((reception[10]& 0xFF)<<8)+(reception[11]& 0xFF);
memset(reception, 0x00, sizeof(reception));
delay(15);
Udp.read(reception,sizeof(reception));
switch (ID_ronde)
{
case 1 :
heur_rond1_s=(reception[0]<<24)+((reception[1]& 0xFF)<<16)+((reception[2]& 0xFF)<<8)+(reception[3]& 0xFF);
min_rond1_s=(reception[4]<<24)+((reception[5]& 0xFF)<<16)+((reception[6]& 0xFF)<<8)+(reception[7]& 0xFF);
heur_rond1_f=(reception[8]<<24)+((reception[9]& 0xFF)<<16)+((reception[10]& 0xFF)<<8)+(reception[11]& 0xFF);
min_rond1_f=(reception[12]<<24)+((reception[13]& 0xFF)<<16)+((reception[14]& 0xFF)<<8)+(reception[15]& 0xFF);
break;
case 2 :
heur_rond2_s=(reception[0]<<24)+((reception[1]& 0xFF)<<16)+((reception[2]& 0xFF)<<8)+(reception[3]& 0xFF);
min_rond2_s=(reception[4]<<24)+((reception[5]& 0xFF)<<16)+((reception[6]& 0xFF)<<8)+(reception[7]& 0xFF);
heur_rond2_f=(reception[8]<<24)+((reception[9]& 0xFF)<<16)+((reception[10]& 0xFF)<<8)+(reception[11]& 0xFF);
min_rond2_f=(reception[12]<<24)+((reception[13]& 0xFF)<<16)+((reception[14]& 0xFF)<<8)+(reception[15]& 0xFF);
break;
case 3 :
heur_rond3_s=(reception[0]<<24)+((reception[1]& 0xFF)<<16)+((reception[2]& 0xFF)<<8)+(reception[3]& 0xFF);
min_rond3_s=(reception[4]<<24)+((reception[5]& 0xFF)<<16)+((reception[6]& 0xFF)<<8)+(reception[7]& 0xFF);
heur_rond3_f=(reception[8]<<24)+((reception[9]& 0xFF)<<16)+((reception[10]& 0xFF)<<8)+(reception[11]& 0xFF);
min_rond3_f=(reception[12]<<24)+((reception[13]& 0xFF)<<16)+((reception[14]& 0xFF)<<8)+(reception[15]& 0xFF);
break;
case 4 :
heur_rond4_s=(reception[0]<<24)+((reception[1]& 0xFF)<<16)+((reception[2]& 0xFF)<<8)+(reception[3]& 0xFF);
min_rond4_s=(reception[4]<<24)+((reception[5]& 0xFF)<<16)+((reception[6]& 0xFF)<<8)+(reception[7]& 0xFF);
heur_rond4_f=(reception[8]<<24)+((reception[9]& 0xFF)<<16)+((reception[10]& 0xFF)<<8)+(reception[11]& 0xFF);
min_rond4_f=(reception[12]<<24)+((reception[13]& 0xFF)<<16)+((reception[14]& 0xFF)<<8)+(reception[15]& 0xFF);
break;
case 5 :
heur_rond5_s=(reception[0]<<24)+((reception[1]& 0xFF)<<16)+((reception[2]& 0xFF)<<8)+(reception[3]& 0xFF);
min_rond5_s=(reception[4]<<24)+((reception[5]& 0xFF)<<16)+((reception[6]& 0xFF)<<8)+(reception[7]& 0xFF);
heur_rond5_f=(reception[8]<<24)+((reception[9]& 0xFF)<<16)+((reception[10]& 0xFF)<<8)+(reception[11]& 0xFF);
min_rond5_f=(reception[12]<<24)+((reception[13]& 0xFF)<<16)+((reception[14]& 0xFF)<<8)+(reception[15]& 0xFF);
break;
default :
break;
}
}
}
else
{
while(ecriture<=6)
{
portOne.write(reception[ecriture]);
ecriture=ecriture+1;
}
ecriture=0;
memset(reception, 0x00, sizeof(reception));
}
}
if(ronde_active==1 && ID_ronde!=0 && ID_ronde<6)
{
trame_ronde[1]=byte (ID_dome);
trame_ronde[0]=0xff;
trame_ronde[2]=0x00;
trame_ronde[4]=0x00;
time2=millis();
if (time2 > time1 + time_of_ronde)
{ fin_tempo=1; }
hum hum.. good luck ^^ ( je m'y remet cette aprem aussi parce que la si c'est pas eux qui ce gene qui gene le softserial.. ethernet? Oo udp..? Oo) bref
merci de ton aide barbudor =) (j'ai couper le prog il était trop gros pour un seul message...