Communication with Arduino via await async . NET

Asked

Viewed 14 times

1

Good afternoon!

I’m studying the best way to communicate my web project with an Arduino board. So far I’ve managed SEND an asynchronous form of a command, according to the code below:

//metodo para acender o led verde...
public static async Task<string> GreenLed(string ipCB)
{
    //acender luz verde...
    using (var client = new HttpClient())
    {
        HttpResponseMessage request = await client.GetAsync("http://" + ipCB + "/5/on");
    }

    return "true";
}

Is there any way RECEIVE Any information from Rduino in the same way, via URL? This is the best way to do this?

  • 1

    Are you using a Shield Wifi or Ethernet on your Arduino? No for Shield Wifi so what I saw in the documentation there is Wifi. h that contains a class that functions as an HTTP client, so you can make requests to your server. NET just like you did for the Arduino.

  • As commented, you need to create an endpoint to receive the requests in your Webapi and implement in the Arduino code for it to send these messages to your API. I recommend that you edit your question by presenting a [mcve]

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.