Code for space x helmet

Microsoft's MakeCode platform for easy blocks-style programming

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
not_so_fast_punk
 
Posts: 7
Joined: Thu Nov 12, 2020 6:07 pm

Code for space x helmet

Post by not_so_fast_punk »

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

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

Re: Code for space x helmet

Post by not_so_fast_punk »

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

User avatar
johnpark
 
Posts: 985
Joined: Wed Mar 25, 2009 2:15 pm

Re: Code for space x helmet

Post by johnpark »

Please post a link to your code or a screenshot.

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

Re: Code for space x helmet

Post by not_so_fast_punk »

makecode capture.PNG
makecode capture.PNG (203.62 KiB) Viewed 505 times
Thanks John! reallyappreciate your help!

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

Will

User avatar
johnpark
 
Posts: 985
Joined: Wed Mar 25, 2009 2:15 pm

Re: Code for space x helmet

Post by johnpark »

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.

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

Re: Code for space x helmet

Post by not_so_fast_punk »

Awesome, thanks so much John.

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

User avatar
johnpark
 
Posts: 985
Joined: Wed Mar 25, 2009 2:15 pm

Re: Code for space x helmet

Post by johnpark »

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.

Locked
Please be positive and constructive with your questions and comments.

Return to “MakeCode”