I’m trying to use the UART of the imp to send data to the agent. i´m already can send data from the agent to the imp device via UART.
I need a 2 ways communication. The idea it´s that when i send something to the imp, this one send some data to the agent, like an answer of it.
Anyone has a code or project with that functionality ? or any ideas?.
i´d appreciate it very much.
UART would be used to connect the imp with an external serial device (hardware connection). The Agent is already connected to the imp. What do you mean by “Agent”?
Here is explanation of Imp’s UART class, which applies to device only: http://electricimp.com/docs/api/hardware/uart/
Click on one of the methods in above link, such as uart.read() and it gives a code example.
Device - Agent / Agent - Device communication is not UART.
When you say 2 ways comms. Is this sync or async comms.
@lightgo, I assume you mean something like:
peripheral <- UART -> imp <- WiFi -> agent
UART is two-way, so you can read UART data into the imp, and write data out to the peripheral. Check out UART Explained for some guidance.
@mlseim with “agent” i mean the web page of the url https://agent.electricimp.com/imp device. In some examples of the dev center when you send data via URL, this one respond a “ok”. The idea it´s change the string “ok” for a data send from the external serial device.
@gerriko I´m already can send data from the agent, to the imp device, to the external serial device(via UART). When the data arrive, the hardware answer a data(via UART). I think that its async com. The idea it´s show that answer in the URL web page. i mean change the “ok” for the data that the hardware answer to the received data from the imp.
@smittytone that´s exactly what i mean. I just have troubles in the part of the imp to the agent com. When i send data in the URL to the peripheral, the peripheral answer data to the imp. How can i show that data in the URL page, i mean change the “ok” string for the data that the hardware send when it receive data from the imp.
Thanks all of you for yours answers
I hope that you can help me
There’s example code in this thread.