Interface and Application Programming

Jump to the hero-shot

Using App Inventor

MIT App Inventor is a tool that allows you to create Android apps with a simple interface, using drag and drop and block-based programming to make complete apps, it also have a companion app that allows you to debug and see the realtime update on your cellphone.

I have used this app before too make a few test and play around, but I did not remember how easy it is to use, and also how powerful tool it can be (with obvious limitations), but with the new extensions it can have a lot of functionality, that I hope will be enough to develop the interface for my final project.

The idea to start

On this week I want to feel conformable with the environment and also explore a bit the possibilities with the layout and user interface building tools. Last time I use this tool I just followed a tutorial and didn't understand well how the layout was made and what you can do with it. The idea is to build a simple Bluetooth app that can connect with my light sensor board and display the value measured.

Layout

Layout tab on app inventor

I created a layout based on a fixed 'header' and 'footer', with a scrollable body that change based on the tab you select from the footer menu.

The layout system is more powerful when you get each layout element as a div or container on web design and nest a bunch of them without fear, then the amount of user interface and media that you can place on your layout is actually big.

Non visible components on AppInventor

I also included non-visible components, Bluetooth and Serial for communications and a few timers for the code. Is important to name things as you create then to have some order and facilitate the code.

Blocks used for the tab system

On the block tab you have a block based system that allows you to code you app, the easies approach is to click on the component you want to trigger an action and see the possible blocks for that.

As you can see on the example on the left are displayed the functions/events available for the disconnect button.



Blocks used for the tab system

This code is used to display visual feedback about which tab is selected and toggle the visibility on the layout elements accordingly.

Blocks used to make Bluetooth connection

This blocks are used to prompt the user width the list of paired devices and connect width the selected. It also updates the state label.

Blocks used to establish serial connection

This code is used to establish serial connection over the USB port and a OTG device. It also updates the label.

Blocks used to display data received

This function is used to update the light value label and display the data received over serial or bluetooth.

Get the AppInventor project file (.aia)


Group Assignment

This week we compare the different methods used to develop applications and interfaces for our projects

Check more here!


Testing

After some test with the companion app from App Inventor, to test mainly the layout and tab functionality I build the app, and download from the QR code directly to my cellphone. After installing I try to connect the the serial port via USB, but with my cellphone (redmi note 8) I wasn't able to connect to my arduino UNO board to use it as a serial bridge to my board.

The next day at the lab we learn about the use on the HC-06 commodity bluetooth module, and how to use AT commands to change the configurations, like the name and pin of the device, see more info on how to doit here.

I also test with a FTDI device and get a wired error that crashes the app, I guess that the library need for driving such device wasn't included on the app code neither on my device

So the test were successful with the Bluetooth module but not width the USB cable connection

Troubleshooting

This week the major problem that I couldn't fix was thh experimental USB connection between the app and my input board. But I also have some trouble while building the layout, but nothing that wasn't fixable with a bit of testing through the companion app.

As a tip that will make this a lot easier, keep everting named correctly on your design, this make your blocks of code more readable. And also makes referencing easier.

Hero-shot!

Bluetooth connection established!

Android application that shows the light level sensed by the board that is currently handle light on my test plant curdle

Conclusions

AppInventor can reduce the development time and technical level needed to make the interface of my final project without sacrifacing functionality, or at least that is what I hope

This week assignment is huge I only use one method even it is powerful I want to cover more but I guess the time will make me develop more interfaces and applications and learn more about it.

Have I?


Prev Next