Structured data
- Category
- Programming
아두이노 프로그래밍 #
연산자 #
- 구분 기호 : ;, {}
- 주석 : //, /**/
- define : #define, #include
- 산술 연산자 : +, -, *, /, %
- 할당 연산자 : =
- 비교 연산자 : ==, !=, <, >, <=, >=
- 부울 연산자 : &&, ||, !
- 포인터 연산자 : *, &
- 비트와 쉬프트 연산자 : &, |, ^, , <<, >>
- 증감 연산자 : ++, --
- 결합 산술 연산자 : +=, -=, *=, /=, %=, &=, |=
조건 및 반복 #
- 조건 : if, if...else, switch case
- 반복 : for, while, do... while
- 분기 및 점프 : break, continue, return, goto
사용의 예 #
const int pinSens = A0; // 아두이노 우노의 A0 포트 사용 예
int gdata[] = { 1, 2, 3, 4, 5, 3};
const int SZARR_DATA = sizeof(gdata)/sizeof(gdata[0]); // 배열 크기 6개를 얻는 경우
#define SZ_IARRDATA (sizeof(gdata)/sizeof(gdata[0]))
const int sz_int = sizeof(int); // 8비트 CPU에서는 주로 2바이트
void loop() {
char cnt;
for (cnt = 0;cnt < SZARR_DATA;cnt++) {
gdata[cnt] = analogRead(pinSens);
deley(100);
}
}