Black Lives Matter - Action and Equality. ... Adafruit joins the Stop Hate for Profit campaign.
0

Lightsaber
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: Lightsaber

by dastels on Mon May 25, 2020 9:01 am

Good stuff!

dastels
 
Posts: 2755
Joined: Tue Oct 20, 2015 3:22 pm

Re: Lightsaber

by Raffistyle on Mon May 25, 2020 5:20 pm

Dave, I sent the seller (of the Through- Hole LED's) a message asking for input about them.
He said
" Adafruit default LED configuration to GBR, but these were RGB. Try changing the 3rd parameter as follows:
Adafruit_NeoPixel(MAX_LED, NEO_PIN, NEO_RGB + NEO_KHZ800)

Sounds simple, if I knew what he was talking about. Does he mean change something in the code or the library?

Raffistyle
 
Posts: 43
Joined: Sat Feb 02, 2019 8:34 pm

Re: Lightsaber

by dastels on Mon May 25, 2020 5:51 pm

That could be it.

Look at around line 44:

Code: Select all | TOGGLE FULL SIZE
strip = neopixel.NeoPixel(NEOPIXEL_PIN, NUM_PIXELS, brightness=1, auto_write=False)


Try changing it to:

Code: Select all | TOGGLE FULL SIZE
strip = neopixel.NeoPixel(NEOPIXEL_PIN, NUM_PIXELS, brightness=1, auto_write=False, pixel_order=neopixel.RGB)

dastels
 
Posts: 2755
Joined: Tue Oct 20, 2015 3:22 pm

Re: Lightsaber

by dastels on Tue May 26, 2020 8:50 pm

It really sounds like the switch is shorting something to ground that it shouldn't.

It works fine until you press the switch? To confirm: the switch has 2 connections, one to the switch input and one to ground?

dastels
 
Posts: 2755
Joined: Tue Oct 20, 2015 3:22 pm

Re: Lightsaber

by Raffistyle on Wed May 27, 2020 1:22 am

Its possible since the switch just hangs out of the hilt for now, until I modify the control box. Also using 3.5mm AUX. jack for a removable blade. I found its not a very reliable blade connection but it does spin freely inside the hilt, so the wires don't twist up when screwing the emitter in place. Plus its easy to unplug for this testing phase.

Back to the code.

When I change that line (Line 45) to:
strip = neopixel.NeoPixel(NEOPIXEL_PIN, NUM_PIXELS, brightness=1, auto_write=False, pixel_order=neopixel.RGB)

The length of that line wont cause issues?

Raffistyle
 
Posts: 43
Joined: Sat Feb 02, 2019 8:34 pm

Re: Lightsaber

by dastels on Wed May 27, 2020 11:06 am

Code line length is irrelevant as far as the compiler is concerned. For ease of editing and reading, 80 is usually the longest line you'll see used. You can format with black to clean things like that up to match canonical python formatting. https://pypi.org/project/black/

Dave

dastels
 
Posts: 2755
Joined: Tue Oct 20, 2015 3:22 pm

Re: Lightsaber

by Raffistyle on Wed May 27, 2020 4:50 pm

Ok.
I changed the line as suggested, the result was obvious and quite funny. If I wouldn't have laughed, I probably would have cried.
Remember I said the first LED was an Adafruit Breadboard-friendly RGB Smart NeoPixel in the crystal chamber, followed by 79 through hole addressable LED's?
The first one was turning green while the rest were red.
Guess what happened when I changed that line?
The first turned red and the rest green,
So I change one LED and it should all be good.

Raffistyle
 
Posts: 43
Joined: Sat Feb 02, 2019 8:34 pm

Re: Lightsaber

by dastels on Wed May 27, 2020 5:18 pm

Yes, that figures. They were different color orders., and so won't work on the same strip.

dastels
 
Posts: 2755
Joined: Tue Oct 20, 2015 3:22 pm

Re: Lightsaber

by sconnolly on Wed May 27, 2020 8:09 pm

Raffistyle i hope this means you got it all working now?

Dave, I seem to be having a problem with the enable switch, its not working to cut power to the boards. i checked the switch and my soldered connections. any other idea what it might/could be?

sconnolly
 
Posts: 7
Joined: Thu May 14, 2020 5:34 pm

Re: Lightsaber

by dastels on Wed May 27, 2020 8:13 pm

sconnolly: Using the EN pin on the Feather? Connecting it to Ground (using the switch) should effectively turn the board off (it disables the 3.3v regulator on the Feather). Can you post a clear photo of the switch and wiring?

Dave

dastels
 
Posts: 2755
Joined: Tue Oct 20, 2015 3:22 pm

Re: Lightsaber

by sconnolly on Wed May 27, 2020 8:53 pm

Ok, I checked my en and ground pins and found my issue. All I needed was the small hint. Thanks Dave!

sconnolly
 
Posts: 7
Joined: Thu May 14, 2020 5:34 pm

Re: Lightsaber

by dastels on Wed May 27, 2020 9:13 pm

I'm glad it wasn't much.

Dave

dastels
 
Posts: 2755
Joined: Tue Oct 20, 2015 3:22 pm

Please be positive and constructive with your questions and comments.