Challenge : use android phone to control a physical process . Tutorial: touch the android device to light a LED.
Baseline:
- Java
- a computer network with wifi
- arduino (the physical process) we have Intel Galileo
- android phone
- laptop (for programming)
- various cables
Android step by step tutorial
Basic skills recap:
1 networking :
- connect devices to same switch via cable of WiFi,
- assign different IPs from the same network. v
- verify connection via ping command
2 arduino:
- install arduino ide
- plug in arduino then plug host usb into the computer
- install driver for arduino from device manager (the driver is in hardware folder from the ide)
- in the arduino ide choose galileo v1/v2 from tools and the available com port (any usb device will show there including your mouse or usb stick)
- run the blink example from the ide
- run the Ethernet->Chat server example code from the ide
- installing Linux on a galileo ( sime consuming and optional)
- format microSD with FAT32
- copy linux Yocoto on it
- put the microSD in the galileo
- plug the galileo in
- play around on this arduino emulator
3 socket communication:
- import the lan test project in Eclipse IDE over java JDK
- run the Server Class as a java app (remember the port and the ip of the machine on which it is running)
- configure the client to connect to the server ip and port
- run the Client Class as java app
4 android:
- download android studio and sdk
- import the MyApplication project into android studio
- create an emulator with minimum resolution, an intel x86 processor and using host gpu
- plug your own android device into a usb port and install it's driver on the pc, set the android device to debug mode
- run the MyApplciation project
- modify the res/layouts/main_activity and the MainActivity class to do your bidding
- to connect to a server from android activity:
- in Activity onCreate add StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().permitAll().build());
- in manifest add <uses-permission android:name="android.permission.INTERNET"/>
Download this code to send emails from Java.