# Problème de communication entre deux Uno via Rx-Tx

**URL:** <https://forum.arduino.cc/t/probleme-de-communication-entre-deux-uno-via-rx-tx/1409228>\
**Category:** Français\
**Created:** [October 12, 2025, 9:38am UTC](https://forum.arduino.cc/t/probleme-de-communication-entre-deux-uno-via-rx-tx/1409228 "2025-10-12T09:38:21Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![bridgingolfingjp](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/bridgingolfingjp/32/1131255_2.png) [@bridgingolfingjp](https://forum.arduino.cc/u/bridgingolfingjp)\
**Post date:** [October 12, 2025, 1:29pm UTC](https://forum.arduino.cc/t/probleme-de-communication-entre-deux-uno-via-rx-tx/1409228/11 "2025-10-12T13:29:04Z")

</div>

merci beaucoup pour ton écoute! depuis plusieurs jours je tente pas mal d'essais infructueux  
Voici le code prévu pour le Uno maître

```arduino

#include "Arduino.h"
#include "Wire.h"
#include <RTClib.h>

#define ButtonState

#define SUNDAY 0
#define MONDAY 1
#define TUESDAY 2
#define WEDNESDAY 3
#define THURSDAY 4
#define FRIDAY 5
#define SATURDAY 6

#define JANUARY 1
#define FEBRUARY 2
#define MARCH 3
#define APRIL 4
#define MAY 5
#define JUNE 6
#define JULY 7
#define AUGUST 8
#define SEPTEMBER 9
#define OCTOBER 10
#define NOVEMBER 11
#define DECEMBER 12

RTC_DS3231 rtc;
  
const int buttonPin = 2; // contact (NO du relais de la barrière)IR
const int resetPin = 3; 

int counter = 0; // compteur du nombre de passages
int buttonState = 0; // état du contact IR (Haut ou Bas)
int lastButtonState = 0; // dernier état du contact IR

void setup() {
  while (!Serial) ;
  Serial.begin(9600);
  pinMode(buttonPin, INPUT);
  pinMode(resetPin, INPUT);
   Wire.begin();
 
  bool buttonPressed = false; // Boolean flag to track button press

 // SETUP RTC MODULE
  if (! rtc.begin()) {
    Serial.println("Couldn't find RTC");
    // Serial.flush();
    while (1);
}
 
  // rtc.adjust(DateTime(F( __DATE__ ), F( __TIME__ ))); // time du PC
    rtc.adjust(DateTime(2025, 10, 9, 20, 59, 0)); // entrée manuelle time A M J h m s
 }

void loop() {

   buttonState = digitalRead(buttonPin); // lecture de l'état du contact IR
  if (digitalRead(buttonPin) == HIGH) {
    counter++;
    Serial.println(counter);
    delay (2000);
}
    lastButtonState = buttonState; // enregistre l'état du contact IR comme dernier état
  
 DateTime now = rtc.now();

 // alarme envoi mail val counter
if (now.hour()== 21 && now.minute()== 0 && now.second()== 0) {
   Serial.write("counter val"); // pour Tx au R4 envoi par mail
   delay (1000);
}
      
 // alarme reset
if (now.hour()== 21 && now.minute()== 1 && now.second()== 0) {
     counter = 0; // reset counter
     delay (1000);
     Serial.println(counter);
  }

```

---

_[View the full topic](https://forum.arduino.cc/t/probleme-de-communication-entre-deux-uno-via-rx-tx/1409228)._
