Skip to content

Latest commit

 

History

History

client

Client

Use this code to send images (or video) to the Pi and show it on the LED table. Code is written in Python 3. For the send_img.py and send_video.py you need to have OpenCV installed. If you are using NixOS you can use the default.nix by invoking nix-shell in the client directory.

The server listens on UDP port 1337 for Open Pixel Control messages. See the link for more information. Channel is ignored, and a maximum of 15x15 LEDs can be controlled.

Command 1 can be used to set a number of pixels individually. This commands expects data to be a multiple of 5 bytes. Each 5 bytes form a set_pixel_color command: (./rand.py uses this)

  • byte 0: x (0-14)
  • byte 1: y (0-14)
  • byte 2: b (blue, 0-255)
  • byte 3: g (green, 0-255)
  • byte 4: r (red, 0-255)

After 5 minutes of inactivity (no UDP packet’s received) the LEDs are turned off.

Usage

The sample scripts connect to the hostname led-table. You should configure this host in your /etc/hosts file, or set the IP address in ./base.py.

rand.py

Sets a random pixel to a random color multiple times a second.

python rand.py

send_img.py

Render an image file and send it to the table.

python send_img.py <image_filename>

send_video.py

Captures an image from your webcam and sends it to the table.

python send_video.py

Instead of the webcam image, you can also uncomment the line in the top of the file to play a video to the table:

# cap = cv2.VideoCapture(2)
cap = cv2.VideoCapture('/home/jos/Videos/test.mp4')