This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| logicpython:cubloc_api:out [2026/04/10 02:06] – created - external edit 127.0.0.1 | logicpython:cubloc_api:out [2026/04/14 04:14] (current) – [Related APIs] mfranklin | ||
|---|---|---|---|
| Line 8: | Line 8: | ||
| from cubloc import Out | from cubloc import Out | ||
| - | Out(pin: int, value: int) | + | Out(pin: int, value: int | bool) |
| </ | </ | ||
| Line 14: | Line 14: | ||
| * **pin**: GPIO '' | * **pin**: GPIO '' | ||
| - | * **value**: '' | + | * **value**: '' |
| ===== Example ===== | ===== Example ===== | ||
| <code python> | <code python> | ||
| - | from cubloc import Out | + | from time import sleep |
| + | from cubloc import | ||
| - | # Example usage | + | # LED on GP25, configured as an output |
| - | Out(0, 1) | + | LED = 25 |
| + | Output(LED) | ||
| + | |||
| + | while True: | ||
| + | # Turn LED on for 500ms | ||
| + | | ||
| + | print(" | ||
| + | sleep(0.5) | ||
| + | |||
| + | # Turn LED off for 500ms | ||
| + | Out(LED, 0) | ||
| + | print(" | ||
| + | sleep(0.5) | ||
| </ | </ | ||
| Line 32: | Line 45: | ||
| * [[logicpython: | * [[logicpython: | ||
| * [[logicpython: | * [[logicpython: | ||
| + | * [[logicpython: | ||