{ "info": { "author": "W. H. Bell", "author_email": "whbqcd1@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "Operating System :: POSIX :: Linux", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Topic :: Home Automation", "Topic :: Software Development", "Topic :: System :: Hardware" ], "description": "=======\nBrickPi\n=======\n\nBrickPi is a package that provides access to the BrickPi Raspberry Pi extension board. \nThe BrickPi extension board is a microprocessor board that allows the Raspberry Pi to \ncommunicate with LEGO Mindstorms motors and sensors. The package provides Python and \nScratch interfaces to the BrickPi.\n\n\nScratch interface\n=================\n\nThe Scratch interface is via a BrickPiScratch class that inherits from GenericDevice,\nwhere GenericDevice is a plugin base class in the RpiScratchIO package.\n\n\nRpiScratchIO configuration file\n-------------------------------\n\nThe Scratch interface uses scratchpy via RpiScratchIO. Sensors should be added by \ndeclaring them in the configuration file::\n\n [DeviceTypes]\n LEGO = import BrickPi; from BrickPi.BrickPiScratch import BrickPiScratch; BrickPiScratch()\n\n [DeviceConnections]\n LEGO = UART0\n\n [BrickPi]\n S1 = ULTRASONIC_CONT\n MA =\n MB =\n\nIn this example, one ultrasonic sensor and two motors are attached to the BrickPi. \nMotors can be added to the MC or MD ports by declaring them in the same manner. Sensors \ncan be added by assigning the senors names to the sensor ports (S1 to S4). The available\nsensor names are::\n\n TOUCH\n ULTRASONIC_CONT\n ULTRASONIC_SS\n RCX_LIGHT\n COLOR_FULL\n COLOR_RED\n COLOR_GREEN\n COLOR_BLUE\n COLOR_NONE\n I2C\n I2C_9V\n\nWhen instantiated, the BrickPiScratch class starts a separate thread to update values \nbetween the BrickPi and the Raspberry Pi at a rate of 10Hz. Values can then be read \nfrom the Raspberry Pi on demand or within the data acquisition loop. To configure the \nautomatic readout to Scratch during the data acquisition loop, the readout period can be \nstated in the configuration file::\n\n LEGO = import BrickPi; from BrickPi.BrickPiScratch import BrickPiScratch; BrickPiScratch(5)\n\nwhere this line should replace the constructor line in the previous example and the number \n5 is the readout period. This means that the sensor or motor encoder values will be \nupdated in Scratch once for every five readout loops. Since the readout loop runs at \n10Hz, this implies that the sensors in Scratch are updated at a rate of 2Hz. For a \nsimple Scratch program running on the Raspberry Pi, a 2Hz update rate is the maximum \nthat Scratch can process without a delay.\n\nSensors or motor encoders can be added to the automatic readout loop by using \nthe channel number (explained later) or \"s\" (for all sensors) or \"m\" (for all motor \nencoders) or \"all\" (for both sensors and motor encoders). The period and sensors can also \nbe added from Scratch by using the config broadcast command (explained later). To prevent the \nautomatic update of sensors or motor encoders when Scratch starts, set the readout \nperiod to 0::\n\n LEGO = import BrickPi; from BrickPi.BrickPiScratch import BrickPiScratch; BrickPiScratch(0,\"S\")\n\nwhere the active sensor channels have all been added in this case too.\n\nAccess from Scratch\n-------------------\n\nStart Scratch from the command line or the menu. Then enable the remote sensor \nconnections by right clicking on the *sensor value* text, which can be found under the \n*Sensing* tool palette. A dialog box should appear to say that the remote sensor \nconnections have been enabled. At this point, Scratch becomes a server. Do not run \nmore than one Scratch window on the same machine, otherwise only the first one will be \naccessible from the Python API. When Scratch has been started, type::\n\n RpiScratchIO configFile.cfg\n\nwhere *configFile.cfg* should be replaced with the name of the configuration file that \nwas created in the previous step. If the name of the configuration file is omitted, \nthen RpiScratchIO will try to use RpiScratchIO.cfg instead.\n\nWhen RpiScratchIO starts, it loads the BrickPiScratch Python class. This updates \nScratch with several new sensors. Using the example configuration files given above, \nthe variables are::\n\n LEGO:0\n LEGO:1\n LEGO:2\n LEGO:3\n LEGO:10\n LEGO:11\n LEGO:12\n LEGO:13\n LEGO:20\n LEGO:21\n LEGO:22\n LEGO:23\n\nwhere these correspond to the sensor ports S1-S4 (0-3), motor ports MA-MD (10-13) and \nmotor encoder ports MA-MD (20-23). The motor channels (10-13) contain the value that was \nwritten to the motors. Values can be read into the sensor values on demand by sending a \nScratch broadcast message of the form::\n\n LEGO:read:0\n\nwhere 0 is the channel number (S1 in this case). The value will then appear in the \ncorresponding sensor approximately 0.2s later.\n\nValues can be written to the motors by sending a Scratch broadcast request of the form::\n\n LEGO:write:10,200 \n\nwhere 10 is the channel number (MA in this case) and 200 is the motor speed value.\n\nScratch can be used to enable the automatic updating of enabled sensor values by broadcasting::\n\n LEGO:config:update,s\n\nwhere the list of channels or wild card options (s for all sensors, m for all motor \nencoders or a list of channels separated by spaces), should follow update. The rate of \nthe update can be set from Scratch by broadcasting::\n\n LEOG:config:period,5\n\nwhere 5 implies 2Hz and 10 implies 1Hz etc.. To disable the automatic readout, the \nperiod should be set to 0.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://pypi.python.org/pypi/BrickPi/", "keywords": "Raspberry Pi BrickPi Scratch", "license": "Creative Commons Attribution-ShareAlike 3.0", "maintainer": null, "maintainer_email": null, "name": "BrickPi", "package_url": "https://pypi.org/project/BrickPi/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/BrickPi/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://pypi.python.org/pypi/BrickPi/" }, "release_url": "https://pypi.org/project/BrickPi/0.1.3/", "requires_dist": null, "requires_python": null, "summary": "BrickPi interfaces for Python and Scratch", "version": "0.1.3" }, "last_serial": 1069656, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "7eda13cccefa1f6052ae65ae2f48f87c", "sha256": "61ea9f55c38f903bb2e0e875eacb3c6272c8b2ee37b068bac50cdf43a73293cf" }, "downloads": -1, "filename": "BrickPi-0.1.0.tar.gz", "has_sig": false, "md5_digest": "7eda13cccefa1f6052ae65ae2f48f87c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10633, "upload_time": "2014-04-14T22:31:12", "url": "https://files.pythonhosted.org/packages/8a/e0/1782d6dfaff2c37766cdf62ebcdce7a382347c46b72f97bc14a7cd68de83/BrickPi-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "c62cbb14cd2f4dcf1100e80fd98e5e26", "sha256": "707602d14045f1a14c11103cba0f81036aaf1979f44f47da5342505948439b57" }, "downloads": -1, "filename": "BrickPi-0.1.1.tar.gz", "has_sig": false, "md5_digest": "c62cbb14cd2f4dcf1100e80fd98e5e26", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12334, "upload_time": "2014-04-22T22:25:51", "url": "https://files.pythonhosted.org/packages/94/0e/ec572020850c9b35afbd6e6161de36176cbc458fbf2ea1e9737f634e86e3/BrickPi-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "2ee24d6a2a45df5e4242fbfdd2e8b579", "sha256": "d17c37f5b1f854403c3c35ebe7bba9f9ffbfdfa42760207f4bbc1705bdd2d373" }, "downloads": -1, "filename": "BrickPi-0.1.2.tar.gz", "has_sig": false, "md5_digest": "2ee24d6a2a45df5e4242fbfdd2e8b579", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12339, "upload_time": "2014-04-23T07:00:54", "url": "https://files.pythonhosted.org/packages/9a/b3/759f094f7155f1e4d0f12caa6a67347e766c58b07ef5821632d2df9429eb/BrickPi-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "12de15a2702344bab789620964e7d901", "sha256": "c7b0f8bff1b916d600340aa1fadd35a3e5c0c4495bf61d479551d8194def93fb" }, "downloads": -1, "filename": "BrickPi-0.1.3.tar.gz", "has_sig": false, "md5_digest": "12de15a2702344bab789620964e7d901", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12921, "upload_time": "2014-04-23T19:40:07", "url": "https://files.pythonhosted.org/packages/b3/73/82d6498e19a11c9a5b53636a43a4c82bfd8e3be715a34abb4a61ea1bf521/BrickPi-0.1.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "12de15a2702344bab789620964e7d901", "sha256": "c7b0f8bff1b916d600340aa1fadd35a3e5c0c4495bf61d479551d8194def93fb" }, "downloads": -1, "filename": "BrickPi-0.1.3.tar.gz", "has_sig": false, "md5_digest": "12de15a2702344bab789620964e7d901", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12921, "upload_time": "2014-04-23T19:40:07", "url": "https://files.pythonhosted.org/packages/b3/73/82d6498e19a11c9a5b53636a43a4c82bfd8e3be715a34abb4a61ea1bf521/BrickPi-0.1.3.tar.gz" } ] }