Home Forums EasyTransfer Library Support Forum SoftEasyTransfer Communication fail action

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #2941
    Anonymous
    Inactive

    Hi I’ve been using your SoftEasyTransfer and firstly thanks very much!

    Hi I’m using SoftwareSerial, SoftEasyTransfer & RS232 to drive relays on one unit from the value transmitted on another unit. All works well, however the relays are normally “high” unless 5v is applied to a pin on the other unit the problem I have is when I disconnect the transmit unit the relays remain HIGH.

    I have added in a “delay” and “else digitalWrite(8, LOW);” after the “if(ET.receiveData()){” it works but there is now intermitant LOWs on the relays I asume due to just catching the “else” at the time the transmit unit is between transmits.

    Is there a way I can change the “else” to a command/instruction that if mySerial recives nothing in a period of 3 seconds to then set the relays to LOW? Thanks in advance

    #2948
    Bill
    Member

    You can implement this in your high level sketch. When this statement is true if(ET.receiveData()){ than a new update has come in. Use a variable to record the system time (millis()) right here.

    Then, at the end of every loop (before the delay) compare the current system time with the last saved time. If the current time is 3 seconds larger, than set your relay values to LOW in the data structure. IF you need more help than this you will have to post your code.

    Bill

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.