Skip to main content

Lets you control neopixels from your PC using a board.

Project description


Control your neopixels from your PC!

Installation

pip install neobridge

Setup (board)

To start controlling neopixels directly from your PC, you have to setup your circuitpython board to receive serial commands. This is already programmed in the code.py script. Follow the steps below.

  1. Download code.py
  2. Move to the circuitpython board (RP2040 is officially supported)
  3. You will need to edit code.py to fit your setup! (Number of LEDs, Pin location, Order)
  4. Run the script. The script will run every bootup.

Setup (PC/Linux/MacOS)

Now that the board is ready for serial communication, you can now control it from your PC directly. This lets you program a lot of cool lighting effects! The example below creates a 'loading' bar like effect.

from itertools import cycle

from neobridge import Neobridge
import serial
import time

FRAME_RATE = 12 # How many frames per second to run code as.

# You have to provide the serial object.
a = Neobridge(serial.Serial(
            'LOCATION OF BOARD',
            baudrate=115200,
            timeout=0.05,
            write_timeout=1), 30)

a.setall((0, 0, 0)) # Set all LEDs to black (nothing)
a.show() # Update to show change!

c = cycle(range(0, 30))
for i in c:
    a.setone((255, 255, 255), i) # Set only one at a time.
    a.show()
    
    a.setall((0, 0, 0)) # Reset to black.
    time.sleep(1 / FRAME_RATE)

Before you can start controlling from PC, you have to enter the location of your board.

  • On Windows, this is usually under a name such as COM3, this can be different.
  • On Linux, it looks like /dev/ttyACM0
  • On MacOS, the name looks like /dev/tty.usbmodem1d12

These names can be different! Make sure to find the right one for the board!

Documentation

a = Neobridge(ser: serial.Serial, n_of_leds: int)
"""
Args:
        `ser (serial.Serial)`: Takes a `serial.Serial` object, this is from **pyserial**
        `n_of_leds (int)`: Number of LEDs on the board.
"""
neobridge.wait_for_response(self)
"""
*Sends a command to the board to wait for a response.*
"""
neobridge.setall(self, rgb: tuple)
"""
*Sets all LEDs on the board to the given RGB values.*
    Args:
        `rgb (tuple)`: RGB values to set.
"""
neobridge.setone(self, rgb: tuple, index: int)
"""
*Sets a single LED on the board to the given RGB values.*
    Args:
        rgb (tuple): RGB values to set.
        index (int): Index of the LED to set.
"""
neobridge.setlist(self, rgb_list: list)
"""
*Gives the board a list of RGB values to set.*
    Args:
        rgb (rgb_list): RGB list to set.
"""
neobridge.show(self)
"""
Sends a command to the board to update the LEDs.
"""

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

neobridge-0.2.1.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

neobridge-0.2.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file neobridge-0.2.1.tar.gz.

File metadata

  • Download URL: neobridge-0.2.1.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.13.2 CPython/3.12.2 Windows/11

File hashes

Hashes for neobridge-0.2.1.tar.gz
Algorithm Hash digest
SHA256 d3834e3f0f4b3a904e656fe1fb9f3884a03e47d8bd102da4a88cc7777d236446
MD5 2bb1e6eab7059d8db10975cf1c180c41
BLAKE2b-256 d1af2e46a705a55780f6e03766578391bafdc34b05de35f719008556fcfa35ff

See more details on using hashes here.

File details

Details for the file neobridge-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: neobridge-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.13.2 CPython/3.12.2 Windows/11

File hashes

Hashes for neobridge-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 27213c6d920d2863a1504d34c1056e1f56f40a50ecc52a9cd72d9df202918da1
MD5 da52a06a5b95df5052e0543bd5b3bdb9
BLAKE2b-256 99a1e81b7f6832e1a9973589ee8617be27ce27b6245486161f144275d0b9bb22

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page