UDOO and App Inventor 2
Hi UDOOers,
Big news for the newcomers to the computing World. We are very happy to announce that with the delivery of UDOO Neo we will introduce UDOO for App Inventor 2 (AI2)!
That is, the opportunity to use App Inventor 2, this amazingly simple open source programming environment, for learning to program non only Smartphone and Tables but also the UDOO boards with their GPIOs!
We have already developed a first set of components to carry out the classic exercises used for getting started with Arduino However, from there, we moved forward so to try to exploit some potentialities of the interaction between Android and Arduino offered by the UDOO boards.
Here an hint of how it works
The UDOO components are non visible components in the App Inventor IDE. They create a connection between the Android app and the Arduino side of the UDOO quad/dual/neo board. The connection can be local (the AI2 app will be installed on the UDOO quad/dual board to control) or remote (to control board/s with another device).
Connection | Transport | API level | OS on UDOO | AI1 app runs on |
local | ADK (USB) | 12 | Android | UDOO board |
remote | TCP/IP | 3 | Linux | other device |
Local connections
Local connections between Android and Arduino use Android ADK. In this scenario the AI2 app runs directly on the UDOO quad/dual board.
Remote connections
Remote connections (eg. AI2 app on a tablet controlling a UDOO quad/dual board in the same or remote network) are implemented using standard TCP/IP sockets (API 3 is fine). On remote connections, for the moment we require the UDOO quad/dual board to run Linux: we use a daemon to redirect TCP requests on the internal serial port connected to the Arduino.
Independently of the connection, the requests made from the App Inventor 2 components are in an open and documented JSON format.
UdooArduino component
This component allows to call the primitive functions on Arduino: pinMode, digitalWrite, digitalRead, analogWrite, analogRead.
UdooArduinoSensor component
This component uses Arduino libraries to access the most used sensors on the market.
Once connected to the Arduino, the components allows you to call ReadSensor.
Examples
Driving a motor (or a LED)
Create a new project and add some buttons to turn the DC motor (connected through a BJT on pin 13) and the LED (plugged directly on pin 12) on and off. Then from the components palette you can pick the UdooArduino component from the UDOO palette:
This component creates a connection to the Arduino, so it is possible to call the functions part of the Arduino API, like digitalWrite. Switch to the Blocks editor to handle the buttons’ click event.
The Connected event fires when a connection between the Android app and the Arduino is established and is intended to contain codes like the Arduino’s setUp() function.
Reading the DHT11 temperature/humidity sensor
Add a UdooArduinoSensor from the UDOO components palette. This component will be used to read the sensor. Add also a button to start the read (or a clock, to read the temperature periodically) and some labels to display the values:
Clicking on the button, the ReadSensor method is called on UdooArduinoSensor. The component will request the actual values from the sensor, and when the sensor data will be ready, the event DataReady will fire.
We invite you all to join us in this new project:
https://groups.google.com/forum/#!forum/app-inventor-open-source-dev