Gardening systeme - Water control with virtual wire

Hy !

This is my first post, and my first attempt to make something with an Arduino. I learned a lot on this web site but i'm still a newbie in the programming world.

I apologize for my English, I try to be understandable as much as a french can be ! Be indulgent please.

My system is based on one master arduino communicating with 5 slave atmega circuits that I've build, through cheap RF 433Mhz Transmitter/Receiver. The atmega control an electro valve with a relay.

I managed to get the wireless communication part working, butt now i'm facing a problem that I can't solve myself.

The code work like this :

The master arduino has a real time clock to provide a daily watering. After the schedule is set with the starting hour and the watering time, the arduino will send the message with the adentification letter and the watering time. The atmega identify its letter and should get from the message how long it has to maintain the relay in high position.

My probleme is that the timing is'nt correct. When I set the watering time with 2 minutes or whatever, the right atmega open the electro valve at the right time but it never shut it down.
I guess the timing part of the message is wrong but I can't find a solution.

If you can provide some help or thinking tracks or anything before I turn crazy, that would be much appreciate !

The code is attached to this message

TX_temps_reboot.ino (3.82 KB)

Reception.ino (1.04 KB)

This is a problem:

          dixaine= buf[1]*10;
          int unit = buf[2];

You are sending "03" to the receiver. That is ASCII characters 48 and 51. So your subsequent calc will ask for 531 minutes of watering. You'll need to subtract 48 from those two values before you use them.