{"id":14437146,"url":"https://github.com/sparkfun/pxt-moto-bit","last_synced_at":"2025-08-11T06:45:17.325Z","repository":{"id":137300830,"uuid":"93871213","full_name":"sparkfun/pxt-moto-bit","owner":"sparkfun","description":"MakeCode package for the SparkFun Moto:Bit board - beta","archived":false,"fork":false,"pushed_at":"2019-02-06T16:15:03.000Z","size":2631,"stargazers_count":7,"open_issues_count":2,"forks_count":7,"subscribers_count":31,"default_branch":"master","last_synced_at":"2025-04-14T21:35:08.984Z","etag":null,"topics":["makecode-extension","pxt","sparkfun"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sparkfun.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-06-09T15:14:17.000Z","updated_at":"2023-02-13T18:10:51.000Z","dependencies_parsed_at":"2024-01-21T05:28:13.101Z","dependency_job_id":null,"html_url":"https://github.com/sparkfun/pxt-moto-bit","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/sparkfun/pxt-moto-bit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sparkfun%2Fpxt-moto-bit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sparkfun%2Fpxt-moto-bit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sparkfun%2Fpxt-moto-bit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sparkfun%2Fpxt-moto-bit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sparkfun","download_url":"https://codeload.github.com/sparkfun/pxt-moto-bit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sparkfun%2Fpxt-moto-bit/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269843250,"owners_count":24484115,"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-11T02:00:10.019Z","response_time":75,"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":["makecode-extension","pxt","sparkfun"],"created_at":"2024-08-31T08:00:24.255Z","updated_at":"2025-08-11T06:45:17.302Z","avatar_url":"https://github.com/sparkfun.png","language":"TypeScript","funding_links":[],"categories":["编程"],"sub_categories":["JavaScript 和 MakeCode"],"readme":"# Moto:bit\n\n![SparkFun Moto:bit](https://raw.githubusercontent.com/sparkfun/pxt-moto-bit/master/icon.png)  \n\nThe package adds support for the **moto:bit** add-on board from SparkFun.\n\nTODO: To use this package, go to https://pxt.microbit.org, click ``Add package`` and search for **moto-bit**.\n\n### ~ hint\n\nNot currently integrated into pxt.  It must be manually added.  This package is still under development and subject to changes.\n\n### ~\n\n## Usage\n\nThe package adds support for the **moto:bit** add-on board from SparkFun.\n\n* [moto:bit](https://www.sparkfun.com/products/14213)\n* [Shadow Chasis](https://www.sparkfun.com/products/13301)\n* [Hobby Gearmotor](https://www.sparkfun.com/products/13302)\n* [Wheel Pair](https://www.sparkfun.com/products/13259)\n* [RedBot Sensor - Line Follower](https://www.sparkfun.com/products/11769)\n* [ine Follower Array](https://www.sparkfun.com/products/13582)\n* [RedBot Sensor - Mechanical Bumper](https://www.sparkfun.com/products/11999)\n* [Servo Extention Cable](https://www.sparkfun.com/products/13164)\n\n### Micro:bit Pins Used \n\nThe following micro:bit pins are used for analog and digital sensors, motor driving:  \n\n* ``P0`` -- Analog Input 0\n* ``P1`` -- Analog Input 1\n* ``P2`` -- Analog Input 2\n* ``P8`` -- Digital Input/Output\n* ``P12`` -- Digital Input/Output \n* ``P14`` -- Digital Input/Output\n* ``P15`` -- Servo Motor\n* ``P16`` -- Servo Motor\n* ``P19`` -- motor driver - SCL\n* ``P20`` -- motor driver - SDA \n\n### Set Motor Speed\n\nTo set the speed and direction for a motor, place the `|set motor|` block.\nThe block takes three parameters: motor select, direction, and speed.\n\n* The motor select must be either `Left` or `Right`\n* Direction must be either `Forward` or `Reverse`\n* Speed is an integer value between `0` and `100`\n\n```blocks\nmotobit.setMotorSpeed(Motor.Left, MotorDirection.Forward, 50)\n```\n\n### Invert Motor Directon\n\nWhen a motor turns opposite to the direction that was declared, the `invert` \nblock may be used. The block accepts two parameters: motor select, and a \nboolean variable. When the boolean is set to `true`, the motor direction is \ninverted so that `Forward` no longer causes the motor to spin in `Reverse`, \nbut rather `Forward`.\n\n* The motor select must be either `Left` or `Right`\n* Invert must be either `true` or `false`\n\n```blocks\nmotobit.invert(Motor.Left, true)\n```\n\n### Enabling Motors\n\nRegardless of the set motor speed, before the motors will turn on the switch on moto:bit\nmust be set to **\"Run Motors\"**, and the enable motors command must be set to `ON`\n\n* Motor enable must be either `On` or `Off`.\n\n```blocks\nmotobit.enable(MotorPower.On)\n```\n\n## Examples\n\n### Example: Receiving a packet of data over wireless\n\nThe following program reads a string to control the direction of two motors.\n\n```blocks\nradio.onDataPacketReceived( ({ receivedNumber }) =\u003e  {\n    // Drive forward\n    if (receivedNumber == 128) {\n        led.plot(2, 0)\n        motobit.setMotorSpeed(Motor.Left, MotorDirection.Forward, 50)\n        motobit.setMotorSpeed(Motor.Right, MotorDirection.Forward, 50)\n        motobit.enable(MotorPower.On)\n    } else {\n        led.unplot(2, 0)\n    }\n    // Turn left\n    if (receivedNumber == 64) {\n        led.plot(0, 2)\n        motobit.setMotorSpeed(Motor.Left, MotorDirection.Reverse, 50)\n        motobit.setMotorSpeed(Motor.Right, MotorDirection.Forward, 50)\n        motobit.enable(MotorPower.On)\n    } else {\n        led.unplot(0, 2)\n    }\n    // Turn right\n    if (receivedNumber == 32) {\n        led.plot(4, 2)\n        motobit.setMotorSpeed(Motor.Left, MotorDirection.Forward, 50)\n        motobit.setMotorSpeed(Motor.Right, MotorDirection.Reverse, 50)\n        motobit.enable(MotorPower.On)\n    } else {\n        led.unplot(4, 2)\n    }\n    // Drive in reverse\n    if (receivedNumber == 16) {\n        led.plot(2, 4)\n        motobit.setMotorSpeed(Motor.Left, MotorDirection.Reverse, 50)\n        motobit.setMotorSpeed(Motor.Right, MotorDirection.Reverse, 50)\n        motobit.enable(MotorPower.On)\n    } else {\n        led.unplot(2, 4)\n    }\n    // Stop\n    if (receivedNumber == 0) {\n        motobit.enable(MotorPower.Off)\n    }\n})\nradio.setGroup(13)\n```\n\n## License\n\nMIT\n\n## Supported targets\n\n* for PXT/microbit\n\n```package\nmotobit=github:sparkfun/pxt-moto-bit\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsparkfun%2Fpxt-moto-bit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsparkfun%2Fpxt-moto-bit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsparkfun%2Fpxt-moto-bit/lists"}