commands:reference:ictuddownstate
차이
문서의 선택한 두 판 사이의 차이를 보여줍니다.
| 다음 판 | 이전 판 | ||
| commands:reference:ictuddownstate [2026/09/01 20:04] – 만듦 - 바깥 편집 127.0.0.1 | commands:reference:ictuddownstate [2026/09/14 20:30] (현재) – 바깥 편집 127.0.0.1 | ||
|---|---|---|---|
| 줄 11: | 줄 11: | ||
| ^ 명령어 ^ 인수 ^ 반환값 ^ 동작 ^ | ^ 명령어 ^ 인수 ^ 반환값 ^ 동작 ^ | ||
| | '' | | '' | ||
| + | |||
| ===== 예제 ===== | ===== 예제 ===== | ||
| + | |||
| + | MPINO-8A4R(T)-S의 P0·P1 입력과 P33 출력을 사용하는 예제입니다. | ||
| <code cpp> | <code cpp> | ||
| - | bool Ictu(uint8_t | + | const uint8_t |
| - | bool Ictd(uint8_t counter_id, | + | const int32_t |
| - | bool Ictud(uint8_t counter_id, bool CU, bool CD, bool RESET, bool LOAD, int32_t PV); | + | |
| - | int32_t IgetCount(uint8_t counter_id); | + | void setup() { |
| - | void IsetCount(uint8_t counter_id, int32_t value); | + | Serial.begin(115200); |
| - | bool IctudDownState(uint8_t counter_id); | + | } |
| + | |||
| + | void loop() { | ||
| + | const bool entered = digitalRead(0) == HIGH; | ||
| + | const bool exited = digitalRead(1) == HIGH; | ||
| + | Ictud(COUNTER_ID, entered, exited, false, false, RACK_CAPACITY); // 증가 입력과 감소 입력을 하나의 카운터에서 처리합니다. | ||
| + | const bool rackEmpty = IctudDownState(COUNTER_ID); // Up/Down 카운터의 하한 완료 상태를 반환합니다. | ||
| + | | ||
| + | } | ||
| </ | </ | ||
| ===== 주의사항 ===== | ===== 주의사항 ===== | ||
| - | '' | + | * 기존 0~31 고정 제한은 제거되었다. 단, 인수 타입이 |
| + | * 메모리가 부족해서 | ||
| + | * 한 번 생성된 카운터 상태는 프로그램 실행 중 유지된다. | ||
| + | |||
| + | ===== 같은 카테고리의 내장 명령어 ===== | ||
| + | |||
| + | * [[commands: | ||
| + | * [[commands: | ||
| + | * [[commands: | ||
| + | * [[commands: | ||
| + | * [[commands: | ||
| [[commands: | [[commands: | ||
commands/reference/ictuddownstate.1788260660.txt.gz · 마지막으로 수정됨: 저자 127.0.0.1
