Skip to content

Conversation

@Sodapop465
Copy link
Contributor

Implemented WS2812 LEDs Jetson Library

  • Add brightness control
  • Removed Raspberry Pi libraries
  • Removed circuitpython rainbow library

@Sodapop465 Sodapop465 linked an issue Mar 27, 2025 that may be closed by this pull request
Copy link
Member

@Hermanoid Hermanoid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some cleaning stuff and a suggestion to use HSV for nicer rainbows :))

self.ledColor = msgs[0]
self.get_logger().info('New color received: %s' % msgs[0])
self.animations[self.currentAnimation](self.colors[msgs[0]])

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a last case here which handles if it's "none of the above", aka an invalid message. Print out a something like "oi butt face you entered [blank] and that's wrong" - feel free to quote me

if len(msgs) == 2:
try:
brightness = float(msgs[1])
if brightness > 1.0:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use the fancy min(max_bound, max(min_bound, number)) method


def pulse(color, wait=0.1):
PIXELS.fill(color)
def rainbow_cycle(self, color, wait=0.1):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ewwwww

tempB = self.rainbowB

# Assigning LED RGB values
for i in range(NUM_LIGHTS):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You couuuuld use HSV and cycle through Hues if you so chose.. colorsys has a thing for that and I think it's in the standard library (so no extra dependency)

@Hermanoid
Copy link
Member

@Sodapop465 Get to work good buddy

@yameatmeyourdead yameatmeyourdead self-requested a review May 2, 2025 20:08
Copy link
Contributor

@yameatmeyourdead yameatmeyourdead left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor changes could be made to make this nicer to use, but thats forward work. good to merge into main

@yameatmeyourdead
Copy link
Contributor

bypassing lucas review

@yameatmeyourdead yameatmeyourdead merged commit ed54295 into main May 2, 2025
1 check passed
@yameatmeyourdead
Copy link
Contributor

can reliably crash this by sending a get_colors or get_animations now

@yameatmeyourdead yameatmeyourdead deleted the LED-strip branch May 2, 2025 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

leds are too bright

4 participants