MODULE 2 Lab 2 - Nyaikamba/IOT-Node-Red GitHub Wiki
ICP 10
This lesson is part of module 2. In class, we focused on how to use MIT App inventor to create and work with apps. The tasks stipulated in class were as follows:
- Create an app on MIT App inventor that turns an LED light on and off
- Connect a sensor with the arduino
- Display results to the app developed on MIT App inventor
- Generate notifications
MIT App - Arduino LED Control
First we created an app using the MIT App Inventor page. This app contained 3 buttons: the Bluetooth button, On button to turn the LED off and an Off button to turn LED off. There was also a text label that displayed whether bluetooth was connected or not once the button was pressed. The steps to make this app were mainly provided on the powerpoint presentation and were reviewed in the class. A few changes were required to ensure that the app looked better.
This is what the design view looked like through the MIT app Inventor
This is the final view of the app on an android phone - The view was much better than the MIT app inventor design view.
App Inventor Code
Next, we worked on the code to enable to app created through design view. This was called blocks on the MIT App Inventor. This was easier to put together but simple logic was required to ensure correct functioning. It was necessary to condense the blocks down as duplicates created errors while trying to run the program. Here is where we set the text label to display when the Bluetooth connection was active or not. We also set the 2 on and off buttons to turn the LED on and off respectfully. Below is a snapshot of the blocks needed to make the led control work alongside the arduino code
Below is the code logic used for this app to function as specified.
Notifications
The next part included sending notifications when the LED is turned on or off. Unfortunately, how this was to be done was very unclear even after asking for clarification. I implemented a simple push notification that showed a notification in the middle of the screen to let you know once the button is pressed and the LED is either on or off.
Here is what that looked like.
LED on
LED Off
At this point, the class session was over and we completed the remaining part outside class. Here is a link to the completed ICP https://github.com/ocampossoto/CS490Iot/wiki/Lesson-10?fbclid=IwAR1ZlDKb-t2Vke2VMt7UIiQXNXoqklWJdzT2L9J4Cy19I-5e2Vpt0Swvq6c