Android Hardware and Control Arduino Workshop
-
Upload
adun-nanthakaew -
Category
Technology
-
view
252 -
download
1
Transcript of Android Hardware and Control Arduino Workshop
24 Mar 2015
Android Hardware Communication
➤ USB
➤ Bluetooth
➤ Wi-Fi
➤ NFC
➤ Telephone ( Voice or DTMF )
➤ SMS
20 Aug 2014
Arduino เชอมตอกบ Android ทาง USB
Arduino เชอมตอกบ Android ทาง USB
Arduino เชอมตอกบ Android ทาง USB
Arduino Firmata Library http://arduino.cc/en/Reference/Firmata
Download Firmata Test Program www.firmata.org
Upload Firmata Sketch
Test Program
USB Workshop
- Arduino Firmata Library - Program Test on PC - Android USB OTG - Android Example Code - Android USB Control Relay Output
Arduino เชอมตอกบ Android ทาง USB
https://play.google.com/store/apps/details?id=arduino.control.servo
Arduino เชอมตอกบ Android ทาง USB
Bluetooth Module
Bluetooth
➤ เปดการใชงานบลทธ ➤ คนหาอปกรณ จบค
➤ เชอมตออปกรณ Connect
➤ รบ - สงขอมล
Bluetooth API
Bluetooth Adapter - คนหาอปกรณ จบค
Bluetooth Class - รายละเอยดหาอปกรณบลทธ Bluetooth Device - ท างานเชอมตออปกรณ
Bluetooth Socket - จดการ รบสงขอมล Bluetooth ServerSocket - เปดชองสญญานเพอตรวจจบอปกรณบลทธอนๆ
Arduino เชอมตอกบ Android ทาง Bluetooth
Arduino เชอมตอกบ Android ทาง Bluetooth
Bluetooth Workshop
- Bluetooth Chat - Bluetooth Control - Bluetooth Control Output - Bluetooth Control RGB LEDs - Bluetooth Control Servo
Arduino เชอมตอกบ Android ทาง Bluetooth
https://play.google.com/store/apps/details?id=arduino.bluetooth.rgbleds
Arduino เชอมตอกบ Android ทาง Bluetooth
Ethernet & Wi-Fi Module
Arduino WebServer
การใชงาน Http Connection
HttpURLConnection conn = null;
try {
conn = (HttpURLConnection)new URL("http://someurl").openConnection();
conn.setRequestMethod("GET");
conn.setInstanceFollowRedirects(true);
conn.setUseCaches(false);
int resCode = conn.getResponseCode();
if (resCode == HttpURLConnection.HTTP_OK) {
InputStream is = conn.getInputStream();
ByteArrayOutputStream bos =
new ByteArrayOutputStream();
int read = 0;
while ((read = is.read()) != -1) {
bos.write(read);
}
byte[] result = bos.toByteArray();
bos.close();
}
( code ตอหนา 2 )
else {
// do something
}
conn.disconnect();
}
catch (Exception e) {
// do something
}
Web Server Control
การใชงาน JSON
ในการตดตอสอสารขอมลตางๆ ระหวาง Client – Server นน จ าเปนจะตองมภาษากลางทใชส าหรบพดคยหรอสงหากน ซงในปจจบน นนภาษากลางดงกลาวทไดรบความนยมสงมากคอ JSON โดย tag ของ JSON นนมลกษณะดงน {"NAME1" : "VALUE1", … , "NAMEn" : "VALUEn"}
{"NAME" : {"NAME1" : "VALUE1", … , "NAMEn" : "VALUEn"} }
{"NAME" : ["VALUE1", … , "VALUEn"]}
{"NAME" : [{"NAME1" : "VALUE1", … , "NAMEn" : "VALUEn"},
. . .
,{"NAME1" : "VALUE1", … , "NAMEn" : "VALUEn"}] }
Wi-Fi Workshop
- Wi-Fi Connection - Arduino Ethernet Web Server - Arduino Wi-Fi ESP8266 Web Server
Arduino เชอมตอกบ Android ทาง Internet
Android Hardware อนๆ
➤ Telephone โทรเขา โทรออก ➤ SMS ➤ Camera กลองหนา กลองหลง ➤ Sensors ตรวจจบความสวาง,อณหภม, ความเอยง ➤ GPS พกด ต าแหนง ➤ NFC
➤ Sound & Vibration
Thank You
Q&A
Website : http://SoftPowerGroup.net
Blog : http://androidcontrol.blogspot.com/