Autumn, 2014
C.-S. Shieh, EC, KUAS, Taiwan
1
智慧電子應用設計導論(1/3)Communication - Serial
Chin-Shiuh Shieh (謝欽旭)
/~csshieh
Department of Electronic Engineering
National Kaohsiung University of Applied Sciences, Taiwan
Autumn, 2014
C.-S. Shieh, EC, KUAS, Taiwan
2
Communication
Built-in
UART
SPI
TWI/I2C
Software
UART
OneWire
…
Autumn, 2014
C.-S. Shieh, EC, KUAS, Taiwan
3
munications
PC
Smart Phone/Bluetooth
/ WiFi,
Wireless UART
GSM
GPS
…
Autumn, 2014
C.-S. Shieh, EC, KUAS, Taiwan
4
Serial -Functions
if (Serial)
available()
begin()
end()
find()
findUntil()
flush()
parseFloat()
parseInt()
Autumn, 2014
C.-S. Shieh, EC, KUAS, Taiwan
5
Serial –Functions (cont)
peek()
print()
println()
read()
readBytes()
readBytesUntil()
setTimeout()
write()
serialEvent()
Autumn, 2014
C.-S. Shieh, EC, KUAS, Taiwan
6
Example – available/read
void setup() {
(9600);(9600);
}
void loop() {
("Hello, Arduino!");
delay(500);
while(()) {
(char(()));
}
delay(500);
}
Autumn, 2014
C.-S. Shieh, EC, KUAS, Taiwan
7
Example – find/parse
void setup() {
(9600);
}
void loop() {
if(("Speed=")){
(());
}
}
Autumn, 2014
C.-S. Shieh, EC, KUAS, Taiwan
8
RS-232 Programming on PC
My personal choice
Borland C++ Builder Librar
Autumn, 2014 来自淘豆网m.daumloan.com转载请标明出处.