BASIC4MCU | 질문게시판 | 아두이노 해석 질문
페이지 정보
작성자 master 작성일2019-06-15 10:57 조회3,440회 댓글0건
https://www.basic4mcu.com/bbs/board.php?bo_table=gac&wr_id=9427
본문
float f=0.0;
void setup(){
Serial.begin(38400);
Serial.println("Float value print");
}
void loop(){Serial.print("value=");
Serial.println(f, 1);
f = f + 0.03;
delay(500);
}
각 코드 하나하나 설명좀요..
//
// MCU BASIC: https://www.basic4mcu.com// DateTime : 2018-10-14 오후 4:39:02// by Ok-Hyun Park//float f=0.0;//void setup(){Serial.begin(38400);Serial.println("Float value print");}//void loop(){Serial.print("value="); Serial.println(f,1); // 소숫점 1자리로 출력f=f+0.03;delay(500);}
0.03씩 더하면서 소숫점 1자리씩 출력하는 간단한 예제입니다.
Serial.println(f,2); // 소숫점 2자리로 출력
소숫점 2자리로 보면 더 알기 쉬울겁니다.
동작시켜보면 금새 이해 할 수 있는 간단한 소스라서 설명을 드릴 것이 없습니다.
댓글 0
조회수 3,440등록된 댓글이 없습니다.