Download presentation
Presentation is loading. Please wait.
Published byPaul Cannon Modified over 9 years ago
1
Autumn, 2013C.-S. Shieh, EC, KUAS, Taiwan1 智慧電子應用設計導論 (1/3) Communication - Serial Chin-Shiuh Shieh ( 謝欽旭 ) http://bit.kuas.edu.tw/~csshieh Department of Electronic Engineering National Kaohsiung University of Applied Sciences, Taiwan
2
Autumn, 2013C.-S. Shieh, EC, KUAS, Taiwan2 Communication Built-in –UART –SPI –TWI/I2C Software –UART –OneWire –…
3
Autumn, 2013C.-S. Shieh, EC, KUAS, Taiwan3 PC Smart Phone/Bluetooth Internet/WiFi,Ethernet Wireless UART GSM GPS …
4
Autumn, 2013C.-S. Shieh, EC, KUAS, Taiwan4 Serial -Functions if (Serial) available() begin() end() find() findUntil() flush() parseFloat() parseInt()
5
Autumn, 2013C.-S. Shieh, EC, KUAS, Taiwan5 Serial –Functions (cont) peek() print() println() read() readBytes() readBytesUntil() setTimeout() write() serialEvent()
6
Autumn, 2013C.-S. Shieh, EC, KUAS, Taiwan6 Example – available/read void setup() { Serial.begin(9600);Serial1.begin(9600); } void loop() { Serial1.println("Hello, Arduino!"); delay(500); while(Serial.available()) { Serial.print(char(Serial.read())); } delay(500); }
7
Autumn, 2013C.-S. Shieh, EC, KUAS, Taiwan7 Example – find/parse void setup() { Serial.begin(9600); } void loop() { if(Serial.find("Speed=")){ Serial.println(Serial.parseInt()); }
8
Autumn, 2013C.-S. Shieh, EC, KUAS, Taiwan8 Example – TMSIW_01/02 http://bit.kuas.edu.tw/~csshieh/teach/101A /mc/advanced/index.html#PCChttp://bit.kuas.edu.tw/~csshieh/teach/101A /mc/advanced/index.html#PCC –http://bit.kuas.edu.tw/~csshieh/teach/101A/mc /advanced/pcc02.ziphttp://bit.kuas.edu.tw/~csshieh/teach/101A/mc /advanced/pcc02.zip –http://bit.kuas.edu.tw/~csshieh/teach/101A/mc /advanced/pcc03.ziphttp://bit.kuas.edu.tw/~csshieh/teach/101A/mc /advanced/pcc03.zip
9
Autumn, 2013C.-S. Shieh, EC, KUAS, Taiwan9 Example – TMSIW_01 void setup() { int i; Serial.begin(9600); for(i=0;i<8;i++)pinMode(14+i,OUTPUT); } void loop() { unsigned char x; int i; while(Serial.available()) { x=Serial.read(); for(i=0;i<8;i++) {digitalWrite(14+i,bitRead(x,i));} Serial.write(analogRead(A0)/4); delay(100); }
10
Autumn, 2013C.-S. Shieh, EC, KUAS, Taiwan10 Serial.print() Serial.read() ComPort programming on PC
11
Autumn, 2013C.-S. Shieh, EC, KUAS, Taiwan11 Example – TMSIW_02 void setup() { Serial.begin(9600); } void loop() { Serial.write(analogRead(A0)/4); delay(100); }
12
Autumn, 2013C.-S. Shieh, EC, KUAS, Taiwan12 Smart Phone/Bluetooth Android programming
13
Autumn, 2013C.-S. Shieh, EC, KUAS, Taiwan13 Internet/WiFi,Ethernet Internet programming on PC or Smartphone
14
Autumn, 2013C.-S. Shieh, EC, KUAS, Taiwan14 Wireless UART
15
Autumn, 2013C.-S. Shieh, EC, KUAS, Taiwan15
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.