Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Makecode: Turn photons off?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Makecode: Turn photons off?

by rockspring on Sun Feb 18, 2018 11:43 am

I am using the photons code in Makecode. I can turn photons on and animate them, but I cannot seem to turn them off. Nothing that I try, from brightness to animation, to clear seems to turn them off.

What am I missing?

Thanks.

rockspring
 
Posts: 3
Joined: Thu Jan 23, 2014 4:32 am

Re: Makecode: Turn photons off?

by rockspring on Sun Feb 18, 2018 11:46 am

Here is the simplest code - turn on a photon, then try to get rid of it. It persists through clear, brightness control, and animation.

Code: Select all | TOGGLE FULL SIZE
loops.forever(function () {
    light.setBrightness(10)
    light.showAnimation(light.rainbowAnimation, 2000)
    light.setPhotonPosition(0)
    for (let index = 0; index <= 10; index++) {
        light.setPixelColor(index, 0xff0000)
    }
    loops.pause(500)
    light.clear()
})

rockspring
 
Posts: 3
Joined: Thu Jan 23, 2014 4:32 am

Re: Makecode: Turn photons off?

by adafruit_support_mike on Mon Feb 19, 2018 2:20 am

[moved to the MakeCode forum]

adafruit_support_mike
 
Posts: 61443
Joined: Thu Feb 11, 2010 2:51 pm

Re: Makecode: Turn photons off?

by LindseyOwn on Tue Feb 20, 2018 3:00 pm

I have a similar question, that I'm pretty sure I posted to the wrong forum...

https://forums.adafruit.com/viewtopic.php?f=24&t=131272

I think if I could turn the photon off, it would solve my game's problem! But I'm not sure. :-) Hoping someone has a solution!

LindseyOwn
 
Posts: 6
Joined: Sun Feb 18, 2018 12:52 am

Re: Makecode: Turn photons off?

by pelikhan on Thu Jun 07, 2018 1:25 am

It is a bit convoluted to turn it off. We'll look into fixing that. Meanwhile,
```
light.onboardStrip().setPhotonPenColor(0x000000)
```

pelikhan
 
Posts: 18
Joined: Wed Sep 27, 2017 12:18 pm

Please be positive and constructive with your questions and comments.