{"id":13693063,"url":"https://github.com/philipphenkel/pxt-powerfunctions","last_synced_at":"2025-08-08T16:11:21.542Z","repository":{"id":144733493,"uuid":"103754807","full_name":"philipphenkel/pxt-powerfunctions","owner":"philipphenkel","description":"MakeCode extension for controlling your LEGO Power Functions devices with an IR-emitting LED","archived":false,"fork":false,"pushed_at":"2020-06-05T09:28:13.000Z","size":1039,"stargazers_count":50,"open_issues_count":1,"forks_count":10,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-30T03:03:29.324Z","etag":null,"topics":["lego","makecode","microbit","pxt-microbit","remote-control"],"latest_commit_sha":null,"homepage":"https://www.hackster.io/philipp-henkel/lego-power-functions-ir-sender-for-micro-bit-aecc10","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/philipphenkel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-09-16T13:40:47.000Z","updated_at":"2025-03-17T20:01:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"804630d4-7e53-4459-a93c-3b33fe1c3688","html_url":"https://github.com/philipphenkel/pxt-powerfunctions","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/philipphenkel/pxt-powerfunctions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philipphenkel%2Fpxt-powerfunctions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philipphenkel%2Fpxt-powerfunctions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philipphenkel%2Fpxt-powerfunctions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philipphenkel%2Fpxt-powerfunctions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/philipphenkel","download_url":"https://codeload.github.com/philipphenkel/pxt-powerfunctions/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philipphenkel%2Fpxt-powerfunctions/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269449507,"owners_count":24419092,"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","status":"online","status_checked_at":"2025-08-08T02:00:09.200Z","response_time":72,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["lego","makecode","microbit","pxt-microbit","remote-control"],"created_at":"2024-08-02T17:01:05.057Z","updated_at":"2025-08-08T16:11:21.501Z","avatar_url":"https://github.com/philipphenkel.png","language":"TypeScript","funding_links":[],"categories":["MakeCode Pakete","编程","🗿 JavaScript and MakeCode"],"sub_categories":["JavaScript 和 MakeCode","🗿 MakeCode Extensions"],"readme":"# Power Functions IR Sender\n\n[![Build Status](https://travis-ci.org/philipphenkel/pxt-powerfunctions.svg?branch=master)](https://travis-ci.org/philipphenkel/pxt-powerfunctions)\n\nControl your LEGO® Power Functions motors using your micro:bit or Calliope-Mini, an infrared LED and MakeCode.\nThis extension turns your device into a remote control for your Power Functions devices.\n\nA project using this extension is documented on [hackster.io](https://www.hackster.io/philipp-henkel/lego-power-functions-ir-sender-for-micro-bit-aecc10)\n\n## Installation\n\nOpen MakeCode and select '+ Extensions' in the 'Advanced' menu. You need to enter our project URL https://github.com/philipphenkel/pxt-powerfunctions in the search field, hit return and then select the powerfunctions extension.\n\n# Documentation\n\n## powerfunctions.connectIrLed\n\nConfigures the infrared LED pin. A 940 nm emitting diode is required.\n\n```sig\npowerfunctions.connectIrLed(AnalogPin.P0)\n```\n\n### Parameters\n\n- `pin` - analog pin with an attached IR-emitting LED\n\n## powerfunctions.setSpeed\n\nSets the speed of a motor.\n\n```sig\npowerfunctions.setSpeed(PowerFunctionsMotor.Red1, 3)\n```\n\n### Parameters\n\n- `motor` - the motor\n- `speed` - the speed of the motor from `-7` to `7`.\n\n## powerfunctions.brake\n\nBrakes then float. The motor's power is quickly reversed and thus the motor will stop abruptly.\n\n```sig\npowerfunctions.brake(PowerFunctionsMotor.Red1)\n```\n\n### Parameters\n\n- `motor` - the motor\n\n## powerfunctions.float\n\nFloats a motor to stop. The motor's power is switched off and thus the motor will roll to a stop.\n\n```sig\npowerfunctions.float(PowerFunctionsMotor.Red1)\n```\n\n### Parameters\n\n- `motor` - the motor\n\n## powerfunctions.setMotorDirection\n\nConfigures a motor direction.\n\n```sig\npowerfunctions.setMotorDirection(PowerFunctionsMotor.Red1, PowerFunctionsDirection.Right)\n```\n\n### Parameters\n\n- `motor` - the motor\n- `direction` - the direction of the motor\n\n## MakeCode Example\n\n```blocks\nbasic.showIcon(IconNames.Heart);\npowerfunctions.connectIrLed(AnalogPin.P1);\n\npowerfunctions.setMotorDirection(\n  PowerFunctionsMotor.Blue1,\n  PowerFunctionsDirection.Backward\n);\n\ninput.onButtonPressed(Button.A, () =\u003e {\n  powerfunctions.setSpeed(PowerFunctionsMotor.Blue1, 3);\n});\n\ninput.onButtonPressed(Button.B, () =\u003e {\n  powerfunctions.float(PowerFunctionsMotor.Blue1);\n});\n\nbasic.forever(() =\u003e {\n  led.plotBarGraph(input.lightLevel(), 255);\n\n  if (input.lightLevel() \u003e 200) {\n    powerfunctions.float(PowerFunctionsMotor.Blue1);\n    basic.pause(5000);\n    powerfunctions.setSpeed(PowerFunctionsMotor.Blue1, 2);\n    basic.pause(3000);\n  }\n});\n```\n\n## Disclaimer\n\nLEGO® is a trademark of the LEGO Group of companies which does not sponsor, authorize or endorse this project.\n\n## License\n\nCopyright (C) 2017-2020 Philipp Henkel\n\nLicensed under the MIT License (MIT). See LICENSE file for more details.\n\n## Supported targets\n\n- for PXT/microbit\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphilipphenkel%2Fpxt-powerfunctions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphilipphenkel%2Fpxt-powerfunctions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphilipphenkel%2Fpxt-powerfunctions/lists"}