{"id":16977372,"url":"https://github.com/mryslab/pymata-cpx","last_synced_at":"2026-05-21T07:03:07.961Z","repository":{"id":57456124,"uuid":"218986017","full_name":"MrYsLab/pymata-cpx","owner":"MrYsLab","description":"A Python API Interface For the Adafruit Circuit Playground Express","archived":false,"fork":false,"pushed_at":"2019-12-30T23:25:52.000Z","size":2184,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-18T20:48:57.864Z","etag":null,"topics":["c-plus-plus","python3"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MrYsLab.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}},"created_at":"2019-11-01T12:59:57.000Z","updated_at":"2020-01-13T18:31:35.000Z","dependencies_parsed_at":"2022-09-04T23:22:18.796Z","dependency_job_id":null,"html_url":"https://github.com/MrYsLab/pymata-cpx","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrYsLab%2Fpymata-cpx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrYsLab%2Fpymata-cpx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrYsLab%2Fpymata-cpx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrYsLab%2Fpymata-cpx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MrYsLab","download_url":"https://codeload.github.com/MrYsLab/pymata-cpx/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244875046,"owners_count":20524591,"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":["c-plus-plus","python3"],"created_at":"2024-10-14T01:28:49.387Z","updated_at":"2026-05-21T07:03:02.936Z","avatar_url":"https://github.com/MrYsLab.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"![logo](https://github.com/MrYsLab/pymata-cpx/blob/master/docs/images/cpx.jpg)\n\n## Control A Circuit Playground Express From Your PC With An Easy To Use Python 3 API\n\nView the Installation and Usage Guide [Here.](https://mryslab.github.io/pymata-cpx/)\n\nIt supports the following CPX devices:\n* The Buttons and Slide Switch.\n* The D13 Board LED.\n* The 10 onboard neo-pixels.\n* Tone generation using the onboard speaker.\n* The accelerometer, including tap sensing.\n* The temperature sensor.\n* The light sensor.\n* The sound sensor.\n* Touchpad sensors.\n\nAn example to animate the neopixels and to start and stop the animation\nby simply tapping the Playground Express:\n\n```python\nimport random\nimport time\n\nfrom pymata_cpx.pymata_cpx import PyMataCpx\n\n\nclass TheTapper():\n    \"\"\"\n    Illuminate the neopixels in a counter-clockwise fashion with randomly generated colors.\n    When you tap the playground express, the neopixels will stop changing and the\n    program pauses. Tap again and the neopixels will start again.\n    \"\"\"\n    def __init__(self):\n        # create an instance of the API\n        self.p = PyMataCpx()\n\n        print('Tap the playground express to stop the neopixels from moving.')\n        print('Tap again, to start them up')\n        print('The tap state will be printed to the console')\n\n        # Start monitoring for tap events and\n        # send event notifications to the \"tapped\" callback method.\n        self.p.cpx_tap_start(self.tapped)\n        \n        # flag to start and stop the light show\n        self.go = True\n\n        while True:\n            try:\n                # run the light show\n                for neopixel in range(0, 10):\n                    # check the go flag\n                    if self.go:\n                        self.p.cpx_pixels_clear()\n                        self.p.cpx_pixels_show()\n                        r = random.randint(0, 254)\n                        g = random.randint(0, 254)\n                        b = random.randint(0, 254)\n                        self.p.cpx_pixel_set(neopixel, r, g, b)\n                        self.p.cpx_pixels_show()\n                        time.sleep(.2)\n                    else:\n                        self.p.cpx_pixels_clear()\n                        self.p.cpx_pixels_show()\n                        time.sleep(.001)\n            except KeyboardInterrupt:\n                # If you press control-C, cleanly exit\n                self.p.cpx_pixels_clear()\n                self.p.cpx_pixels_show()\n                self.p.cpx_close_and_exit()\n\n    def tapped(self, data):\n        \"\"\"\n        :param data: data[0] = data type (analog = 2, digital =32)\n                     data[1] = pin for device 27\n                     data[2] = tap data - list of booleans.\n                               First value for 1 tap\n                               Second value for 2 taps\n        \"\"\"\n        # for any taps, toggle the go flag\n        # print out the current go state\n        if data[2] != [False, False]:\n            self.go = not self.go\n            print(self.go)\n\n# start the program\nTheTapper()\n\n```\n\nThis project was developed with\n[Pycharm](https://www.jetbrains.com/pycharm/?from=pymata-cpx)\n![logo](https://github.com/MrYsLab/python_banyan/blob/master/images/icon_PyCharm.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmryslab%2Fpymata-cpx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmryslab%2Fpymata-cpx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmryslab%2Fpymata-cpx/lists"}