{"id":20427073,"url":"https://github.com/pi4j/pi4j-kotlin","last_synced_at":"2025-04-12T19:10:18.712Z","repository":{"id":64654840,"uuid":"535721641","full_name":"Pi4J/pi4j-kotlin","owner":"Pi4J","description":"Kotlin DSL for Pi4J V2","archived":false,"fork":false,"pushed_at":"2024-07-25T13:10:02.000Z","size":148,"stargazers_count":49,"open_issues_count":2,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-26T13:21:18.435Z","etag":null,"topics":["dsl","gpio","kotlin","kotlin-backend","kotlin-bindings","kotlin-library","pi4j","pi4k","raspberry-pi","raspberry-pi-gpio"],"latest_commit_sha":null,"homepage":"https://pi4j.com/kotlin/","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Pi4J.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-12T15:04:05.000Z","updated_at":"2025-02-26T02:21:06.000Z","dependencies_parsed_at":"2024-07-25T13:08:43.031Z","dependency_job_id":null,"html_url":"https://github.com/Pi4J/pi4j-kotlin","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pi4J%2Fpi4j-kotlin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pi4J%2Fpi4j-kotlin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pi4J%2Fpi4j-kotlin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pi4J%2Fpi4j-kotlin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Pi4J","download_url":"https://codeload.github.com/Pi4J/pi4j-kotlin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248618277,"owners_count":21134200,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dsl","gpio","kotlin","kotlin-backend","kotlin-bindings","kotlin-library","pi4j","pi4k","raspberry-pi","raspberry-pi-gpio"],"created_at":"2024-11-15T07:18:37.444Z","updated_at":"2025-04-12T19:10:18.687Z","avatar_url":"https://github.com/Pi4J.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pi4J - Kotlin\n\nKotlin Interface \u0026 DSL for [Pi4J V2](https://github.com/Pi4J/pi4j-v2)  \nFor Pi4J V1 Kotlin Bindings, check [Pi4K](https://github.com/mhashim6/Pi4K) (no longer supported).\n\n[![Awesome Kotlin Badge](https://kotlin.link/awesome-kotlin.svg)](https://github.com/KotlinBy/awesome-kotlin)\n[![Maven Central](https://img.shields.io/maven-central/v/com.pi4j/pi4j-ktx.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.pi4j%22%20AND%20a:%22pi4j-ktx%22)\n[![License](https://img.shields.io/github/license/pi4j/pi4j-v2)](http://www.apache.org/licenses/LICENSE-2.0)\n![GitHub Actions build state](https://github.com/pi4j/pi4j-kotlin/workflows/Build%20pi4j-kotlin/badge.svg)\n\n## Documentation\nFull documentation can be found on the [website](https://pi4j.com/kotlin/kotlin-api-docs/)\n\n## Example\n\nThis is a minimal working example, make sure\nto [check it out](https://github.com/Pi4J/pi4j-kotlin/blob/master/example/src/main/kotlin/MinimalExample.kt) for full\nintroduction and comments.\n\n``` kotlin\nconst val PIN_BUTTON = 24 // PIN 18 = BCM 24\nconst val PIN_LED = 22 // PIN 15 = BCM 22\nvar pressCount = 0\n\nconsole {\n  title(\"\u003c-- The Pi4J Project --\u003e\", \"Minimal Example project\")\n  pi4j {\n    digitalInput(PIN_BUTTON) {\n        id(\"button\")\n        name(\"Press button\")\n        pull(PullResistance.PULL_DOWN)\n        debounce(3000L)\n        piGpioProvider()\n      }.onLow {\n        pressCount++\n        +\"Button was pressed for the ${pressCount}th time\"\n      }\n    }\n    \n    digitalOutput(PIN_LED) {\n        id(\"led\")\n        name(\"LED Flasher\")\n        shutdown(DigitalState.LOW)\n        initial(DigitalState.LOW)\n        piGpioProvider()\n      }.run {\n        while (pressCount \u003c 5) {\n          +\"LED ${state()}\"\n          toggle()\n          sleep(500L / (pressCount + 1))\n        }\n      }\n    }\n  }\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpi4j%2Fpi4j-kotlin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpi4j%2Fpi4j-kotlin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpi4j%2Fpi4j-kotlin/lists"}