14. Interface and application programming

This week we had to make a user interface so a user could interact with the development boards we made in previous weeks. Processing is a nice program we can use to create user interfaces on the computer and interact with peripherals using serial communication, UDP, TCP, HTTP or a range of other protocols. I decided to use UDP as the means of communication with the board this week. The board would act as both the UDP server and the wifi network.

View the group assignment here

The Program's Functionality

The user on the computer can do a right or left click and a corresponding number (0 or 1 respectively) will be displayed on the tft screen attached to the esp microcontroller.

Arduino Code

The arduino code can be broken down as folows:

Processing Code

The processing code can be broken down as follows. This is run on my laptop.

In action

Concluding Thoughts

This worked pretty consistently but if I really wanted to ensure that the screen changed appropriately to every mouse click I would've used a protocol that gives an acknowledgement like TCP or HTTP (whcih is built on top of TCP). This would allow the laptop to know when data was not received and give the opportunity to resend it.

Code files

code for this week can be found here