In this section, we will build a project to enable an ESP32 board to work with mobile devices. We can create Wi-Fi services on an ESP32 board to allow mobile devices to perform tasks on ESP32, such as turning on a lamp and turning off a motor. Our scenario is described in Figure 9.1. For a mobile device platform, we use the Android application.
The way in which a smart mobile project works can be seen in the following diagram:
Figure 9.1: A general design for a smart mobile project
We can control three lamps with an ESP32 board through relay modules as shown in the preceding diagram. For a simple demonstration, we only use three LEDs for lamp simulation. We will expose three HTTP services: /ping, /state, and /lamp:
- The /ping HTTP request is used to perform an echo test.
- The /state HTTP request is used to obtain all the LED states that...