0

Code for space x helmet
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Code for space x helmet

by not_so_fast_punk on Thu Nov 12, 2020 6:09 pm

Hey guys,

I've been following your build guide for the space x helmet - https://learn.adafruit.com/spacex-helmet/assemble

Its awesome and everything seems to be working, however the link to the suggested makecode code doesnt load...

Is it possible to refresh the link so I can see the code you used?

Many thanks in advance!

Will

not_so_fast_punk
 
Posts: 7
Joined: Thu Nov 12, 2020 6:07 pm

Re: Code for space x helmet

by not_so_fast_punk on Fri Nov 13, 2020 3:27 am

maybe someone else here can help me with the makecode? I'm new to the maker world but I'm very keen to learn...

Basically ive mounted my circuit playground inside the outer shell of the helmet - when the shell/visor is down, i would like the neopixels to pulse white, and when i raise the visor (changing the orientation of the CPG) I would like the neopixels to pulse in a different colour or trigger an animation like a ripple effect....

I have it all working so everything lights up but i would like to introduce some logic inputs to create different effects when I interact with the helmet. I've tried uploading various attempts and the animations seem to play for a split second before reverting to the original state...

If anyone can provide some suggestions it would be most appreciated - I suspect I am running into trouble with the 'forever' state makecode block since it seems to revert back to this statealmost immediately..

thanks in advance! =)

Will

not_so_fast_punk
 
Posts: 7
Joined: Thu Nov 12, 2020 6:07 pm

Re: Code for space x helmet

by johnpark on Fri Nov 13, 2020 1:49 pm

Please post a link to your code or a screenshot.

johnpark
 
Posts: 881
Joined: Wed Mar 25, 2009 2:15 pm

Re: Code for space x helmet

by not_so_fast_punk on Fri Nov 13, 2020 8:21 pm

makecode capture.PNG
makecode capture.PNG (203.62 KiB) Viewed 356 times


Thanks John! reallyappreciate your help!

https://makecode.adafruit.com/beta?webusb=1#editor

Will

not_so_fast_punk
 
Posts: 7
Joined: Thu Nov 12, 2020 6:07 pm

Re: Code for space x helmet

by johnpark on Fri Nov 13, 2020 9:28 pm

The Forever loop is battling the on face up loop. You'll probably want to have the pixels turn red in the on start loop and then use the on face up to turn them purple and an on face down to turn them back to red, this way you have two distinct states.

johnpark
 
Posts: 881
Joined: Wed Mar 25, 2009 2:15 pm

Re: Code for space x helmet

by not_so_fast_punk on Fri Nov 13, 2020 9:48 pm

Awesome, thanks so much John.

Is there any easy way to the make the leds pulse (increase then decrease brightness)?

not_so_fast_punk
 
Posts: 7
Joined: Thu Nov 12, 2020 6:07 pm

Re: Code for space x helmet

by johnpark on Tue Nov 24, 2020 6:47 pm

Here's one way https://makecode.com/_40LieUXbWco1
It increases the value by 1 over and over until it reaches 255, then decreases by 1 over and over until it reaches 0, then repeats. If you need to do other things in your code you can put this in a Control > run in parallel block so the timing doesn't get screwy.

johnpark
 
Posts: 881
Joined: Wed Mar 25, 2009 2:15 pm

Please be positive and constructive with your questions and comments.