Home/Support/Support Forum/How can I know if an output is set?

How can I know if an output is set?

0 votes
Say that I have two routers and one coordinator. On one router I have a button as an input configured as change detect that will send data to the coordinator connected to an arduino. With that button pushed, I must change the state of an output on the another router, that is, if it is high, must turn to low, and if it is low, must turn to high. The problem is that there is no AT command, I think, that invert the state of and output, just commands to set it high and to set low. With that in mind, at first I must read the state of that output to see if I must send a high or low command to invert it. How can I solve this problem?
asked Mar 24, 2015 in XCTU by pedrobneto New to the Community (0 points)

Please log in or register to answer this question.

3 Answers

0 votes
You are going to be using API mode on your coordinator since that is where your intelagence is going to be located.

You are going to need to read the API receve frame from the change detect. Then based off of the value received, issue the proper API Remote AT command to the other module setting the desired line as an output high or low.
answered Mar 25, 2015 by mvut Veteran of the Digi Community (11,302 points)
0 votes
With that button pushed, I must change the state of an output on the another router, that is, if it is high, must turn to low, and if it is low, must turn to high. The problem is that there is no AT command, I think, that invert the state of and output, just commands to set it high and to set low. With that in mind, at first I must read the state of that output to see if I must send a high or low command to invert it. How can I solve this problem???

________________
GuL
answered Mar 26, 2015 by ainwee New to the Community (1 point)
Gul,

You are going to need to use API mode on radio 1.  Radio 2 and 3 are going to need to have your Input line Enabled on a DIO line along with Change Deetect Enabled.

When the state changes, a Frame from radio 2 will be sent to radio 1. Radio 1 will send out of its UART an API frame statiing tha a line state occured on moduel with 64 bit address and the line is now at a state of blank.  You are then going to need to understand that frame in your Code and issue a remote AT command to module 2 telling that module to change line X to an output y state.
0 votes
I don't think mvut understood your question.

The way to find the status of a digital output is to send the ATDx command without a parameter and with a non-zero frame_id so that you get a confirmation back. The parameter value in the confirmation contains the setting of the pin which is 4 for low, 5 for high. If the frame_id is 0 then you don't get a confirmation back.

(Yes, the documentation is a little unclear about it; I used a bit of trial and error but found it pretty quickly - Raspberry Pi and Python might make that easier than Arduino).
answered May 20, 2015 by alistair New to the Community (1 point)
...