This shows you the differences between two versions of the page.
| de:software:libraries:pin [2009/09/10 21:18] – angelegt mikk.leini | de:software:libraries:pin [2020/07/20 12:00] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Pin Operationen ====== | ||
| + | Der folgende Code demonstriert den Gebrauch der Header-File " | ||
| + | |||
| + | * {{: | ||
| + | |||
| + | ===== Example ===== | ||
| + | |||
| + | <code c> | ||
| + | #include < | ||
| + | #include " | ||
| + | |||
| + | #define LED1 PORTPIN(C, 1) | ||
| + | #define BUTTON1 PORTPIN(C, 2) | ||
| + | |||
| + | int main(void) | ||
| + | { | ||
| + | unsigned char x; | ||
| + | |||
| + | // Configuring pin as an output | ||
| + | pin_setup_output(LED1); | ||
| + | |||
| + | // Setting pin high | ||
| + | pin_set(LED1); | ||
| + | |||
| + | // Setting pin low | ||
| + | pin_clear(LED1); | ||
| + | |||
| + | // Setting pin to specified state (1 or 0) | ||
| + | pin_set_to(LED1, | ||
| + | |||
| + | // Toggling pin state (from high to low and vice versa) | ||
| + | pin_toggle(LED1); | ||
| + | |||
| + | // Configuring pin as an input | ||
| + | pin_setup_input(BUTTON1); | ||
| + | |||
| + | // Reading input pin value | ||
| + | pin_get_value(BUTTON1, | ||
| + | } | ||
| + | </ | ||