Skip to content

14. Interface and application programming

Group assignment:

  • Compare as many tool options as possible

To see our group assignment click here

Individual assignment:

  • Write an application that interfaces a user with input and/or output device(s) on a board that you made.

APPLICATION PROGRAMMING

For this week, we decided to develop an application for our final project. For this we used FLUTTERFLOW and flutter framework on VScode sofware, a free online website.

To get started, we’ll open flutterflow, register and start building our application interface as shown below.

After our registration we are ready to create our project. On the left we have the menu for work organization and profile. To start our project, we’ll click on the right as shown in the image.

We now need to name our project, and we’re ready to continue.

We can choose the colors for our application and then continue

After creating our different pages we can see the interconnections you have made the back-end programming on VScode with the flutter framework.

COMMUNICATION

For communication, we used the http protocol. To do this, we’re using the arduiuno IDE and library software we’ve already installed for previous projects. Please follow the steps in the images below:

Now we need to copy the link of our application in its place.

To complete the connection, we need to set the reference of our wi-fi access point.

  • HTTP Request Configuration
AsyncHTTPSRequest request;

An instance of the AsyncHTTPSRequest class is created to handle asynchronous HTTP requests.

  • Definition of the Request Callback Function
void requestCB(void *optParm, AsyncHTTPSRequest *request, int readyState)
{
  //...
}

This function is called whenever the state of the request changes. It receives three parameters: an optional pointer, a pointer to the AsyncHTTPSRequest object, and the current state of the request.

  • Sending the Request
void sendRequest(float temp)
{
  //...
}

This function constructs the request URL based on the measured temperature and sends the HTTP GET request to the remote server.

  • Processing the Response

In the requestCB callback function, the server’s response is parsed. If the response code is 200, it means the request was successful. Otherwise, an error is reported.

  • Integration into the Main Loop
void loop()
{
  //...
}

In the main loop, when the temperature variable is true, the temperature is measured, and an HTTP request is sent to transmit it to the remote server.

FILES


Last update: May 14, 2024