React Native Smart Switch App – Arduino – Part 1

We are starting a new series of tutorial in which we will be creating Mobile Application as well as IOT gadgets using micro-controller like Arduino. The app will control the IOT device. Because “If you are serious about software you need to make your own hardware” – Nikos Askitas.

For this tutorial we will be creating a Smart Switch App. Using the app we can turn on a light and the light will turn off automatically after some time ( i.e. the time for which it has been set). The app will allow users to create multiple switches to turn off light after different time period. For example, we can create a switch named “loo” to turn off after 2 mins and another switch named “Bath” to turn off after 5 mins. The app will connect with our device using bluetooth. So, lets start by creating our app.

To add bluetooth data transfer we will use ‘react-native-bluetooth-serial’ package. Below is the code to enable, disable bluetooth and list paired devices :

In the above code we are checking the status of bluetooth when the app loads. If it is enabled then we list the paired devices. Also, we can enable or disable bluetooth and on enabling we update the list of paired devices.

Video Tutorial :