프로그램&회로
arduino Serial 통신
엠칩
2024. 5. 3. 09:51
void setup(void) {
Serial.begin(115200);
Serial.println("Connected");
}
void loop(void) {
Serial.print("text : ");
Serial.print(78, BIN) gives "1001110"
Serial.print(78, OCT) gives "116"
Serial.print(78, DEC) gives "78"
Serial.print(78, HEX) gives "4E"
Serial.print(1.23456, 0) gives "1"
Serial.print(1.23456, 2) gives "1.23"
Serial.print(1.23456, 4) gives "1.2346"
Serial.print(78, OCT) gives "116"
Serial.print(78, DEC) gives "78"
Serial.print(78, HEX) gives "4E"
Serial.print(1.23456, 0) gives "1"
Serial.print(1.23456, 2) gives "1.23"
Serial.print(1.23456, 4) gives "1.2346"
Serial.write( value );
Serial.println(); // line feed
if (Serial.available() > 0) { // 수신버퍼 확인
char temp = Serial.read(); // 읽어온 것을 변수에 저장
// Serial.scan
}
}
반응형