# Makecode Set strip command error

**URL:** https://forum.makecode.com/t/makecode-set-strip-command-error/588
**Category:** Maker
**Created:** [October 6, 2019, 11:30pm UTC](https://forum.makecode.com/t/makecode-set-strip-command-error/588 "2019-10-06T23:30:41Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![cantcodewell](https://avatars.discourse-cdn.com/v4/letter/c/3ec8ea/32.png) [@cantcodewell](https://forum.makecode.com/u/cantcodewell)
#### Post date: [October 6, 2019, 11:30pm UTC](https://forum.makecode.com/t/makecode-set-strip-command-error/588/1 "2019-10-06T23:30:42Z")

</div>

I am new to this. Have dabbled in some sketch but I am a newb.  
I use win10  
I have a Gemma m0  
But the problem I am having is when I use the code provided for a project when I open it in makecode it throws error on the set strip line. I have tried rebuilding by hand. I had this working a week ago. I don’t think it has anything to do with the Gemma because I cannot get it to work in the visualizer/virtual model.  
All I wanted to do was change the pixel count from 30 to 60 on the strip setup under start. Any ideas? Here is the file I am using to get this tested out. It worked with 30 on the Gemma I had it loaded on from where I was playing with the device bfore I wired it up. I also tried to upload with a spare Gemma I have and although the Gemma works the code will not upload because of the error.  
[https://maker.makecode.com/29855-53175-12460-49135](https://maker.makecode.com/29855-53175-12460-49135)

Will include photos.

 ![Annotation%202019-10-06%20134739](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/1X/590e940fe16ba8a8e17a3bc99a2312627fec6a4d.png)

---

<div class="post-metadata">

### Author: ![cantcodewell](https://avatars.discourse-cdn.com/v4/letter/c/3ec8ea/32.png) [@cantcodewell](https://forum.makecode.com/u/cantcodewell)
#### Post date: [October 6, 2019, 11:32pm UTC](https://forum.makecode.com/t/makecode-set-strip-command-error/588/2 "2019-10-06T23:32:14Z")

</div>

Here is what the error looks like in Java

 ![Annotation%202019-10-06%20140527](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/1X/d5830389f5c4a9a391a2f04166e3efe782323f96.png)

I have been plugging away at this for hours today. Probably more than 6.

I also have an Adafruit Circuit Playground Express. I was able to use that Microsoft MakeCode For Circuit Playground Express to make a very similar code for it. It went very easy.

For some reason the Microsoft [MakeCode.com](http://MakeCode.com) just will not allow me to set up a neopixel strip. I feel somewhat puzzled. As I was able to test the code but now I am unable to edit it without getting the error.

Anyway thanks if anyone can point me in the right direction.

---

<div class="post-metadata">

### Author: ![peli](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/peli/32/12_2.png) [@peli](https://forum.makecode.com/u/peli)
#### Post date: [October 7, 2019, 10:38pm UTC](https://forum.makecode.com/t/makecode-set-strip-command-error/588/3 "2019-10-07T22:38:33Z")

</div>

I’ll take a peek later tonight.

---

<div class="post-metadata">

### Author: ![cantcodewell](https://avatars.discourse-cdn.com/v4/letter/c/3ec8ea/32.png) [@cantcodewell](https://forum.makecode.com/u/cantcodewell)
#### Post date: [October 7, 2019, 11:35pm UTC](https://forum.makecode.com/t/makecode-set-strip-command-error/588/4 "2019-10-07T23:35:51Z")

</div>

It has something to do with this here.  
I was able to use this with java and make it work. I just need to understand why exactly.  
Its an error in the 3rd statement somehow. I have learned a little with this. Just want to understand more.

> <https://github.com/microsoft/pxt-maker/issues/255>
>
> Describe the bug
> Getting a typescript error when creating a WS8201 strip.
> To Reproduce
> Just use the sample code for "create script":
> let strip =...

---

<div class="post-metadata">

### Author: ![cantcodewell](https://avatars.discourse-cdn.com/v4/letter/c/3ec8ea/32.png) [@cantcodewell](https://forum.makecode.com/u/cantcodewell)
#### Post date: [October 8, 2019, 12:10am UTC](https://forum.makecode.com/t/makecode-set-strip-command-error/588/5 "2019-10-08T00:10:32Z")

</div>

![Annotation%202019-10-07%20183947%20-%20Copy](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/1X/fb487df90a361fce663dc2713f357330c3c8a6c3.png)  
This is what I came up with in Java from the github link that someone from Adafruit found for me. Just posting for others to see. I can only post one image in a post at this time so I will reply again with what it looks like in blocks.

---

<div class="post-metadata">

### Author: ![cantcodewell](https://avatars.discourse-cdn.com/v4/letter/c/3ec8ea/32.png) [@cantcodewell](https://forum.makecode.com/u/cantcodewell)
#### Post date: [October 8, 2019, 12:11am UTC](https://forum.makecode.com/t/makecode-set-strip-command-error/588/6 "2019-10-08T00:11:43Z")

</div>

![Annotation%202019-10-07%20183948%20-%20Copy](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/1X/4116f725f29dcad94eeead1981f7f12cd893c345.png)

Here is my example in blocks for others to see. I am at a little bit of a loss on how one would come up with this but I am learning. Now on to building a second set of what I am working on.

---

<div class="post-metadata">

### Author: ![peli](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/peli/32/12_2.png) [@peli](https://forum.makecode.com/u/peli)
#### Post date: [October 8, 2019, 4:41am UTC](https://forum.makecode.com/t/makecode-set-strip-command-error/588/7 "2019-10-08T04:41:46Z")

</div>

Looks like a compiler bug - thanks for reporting. As a temporary fix, specify the neopixel mode argument.

---

<div class="post-metadata">

### Author: ![KMSkelton](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/kmskelton/32/400_2.png) [@KMSkelton](https://forum.makecode.com/u/KMSkelton)
#### Post date: [October 8, 2019, 5:28am UTC](https://forum.makecode.com/t/makecode-set-strip-command-error/588/8 "2019-10-08T05:28:40Z")

</div>

Great work reporting this bug! I wish the bug reports I got at work were this detailed and well described. I would say your username is not an accurate description of your ability to code (most of which is solving problems like this one).

@Peli thanks for the workaround

---

<div class="post-metadata">

### Author: ![peli](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/peli/32/12_2.png) [@peli](https://forum.makecode.com/u/peli)
#### Post date: [October 8, 2019, 5:57am UTC](https://forum.makecode.com/t/makecode-set-strip-command-error/588/9 "2019-10-08T05:57:34Z")

</div>

The fix is live.

---

<div class="post-metadata">

### Author: ![cantcodewell](https://avatars.discourse-cdn.com/v4/letter/c/3ec8ea/32.png) [@cantcodewell](https://forum.makecode.com/u/cantcodewell)
#### Post date: [October 8, 2019, 9:09pm UTC](https://forum.makecode.com/t/makecode-set-strip-command-error/588/10 "2019-10-08T21:09:48Z")

</div>

Thanks, I think I understand it was lacking the mode RGB designator but not sure why. does this have more to do with the website and how it incorporates libraries for functions?  
is there a guide to building blocks

---

<div class="post-metadata">

### Author: ![KMSkelton](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/kmskelton/32/400_2.png) [@KMSkelton](https://forum.makecode.com/u/KMSkelton)
#### Post date: [October 9, 2019, 2:25am UTC](https://forum.makecode.com/t/makecode-set-strip-command-error/588/11 "2019-10-09T02:25:45Z")

</div>

I took from Peli’s response that there was a compiler error, so there’s not much that users would be able to do. I tried to get this to work by specifying the RBG designator and didn’t have any luck.

I am not aware of a guide for building blocks. Is there a particular thing you’re trying to do?

---

<div class="post-metadata">

### Author: ![cantcodewell](https://avatars.discourse-cdn.com/v4/letter/c/3ec8ea/32.png) [@cantcodewell](https://forum.makecode.com/u/cantcodewell)
#### Post date: [October 9, 2019, 2:49am UTC](https://forum.makecode.com/t/makecode-set-strip-command-error/588/12 "2019-10-09T02:49:06Z")

</div>

I would like to modify an animation or make a new one. I like the rainbow effect that is a animation. But I am interested in changing the order at which the pixels travel. The way I had to wrap my strip around the ears (mickey ear project from adafruit) to make it look like I think it should made the animation play the wrong way on one strip. IMO  
I would like to also possible make one of the other animations like the blue or green chase in maybe some other colors. I feel like if I could edit the animations I could tailor them a little to something I am wanting.  
I could then use this to possibly make some new animations to add to the library? is that what you all call the pre made blocks repository? I know there is a huge neopixel library for strand animations but I don’t know how to bring anything I am looking for into this makecode environment. Which for now is what I am using for this project. In the future I may look into writing this in circuitpython or something.

But for now if I could just edit the animations themselves it would be super cool.  
Sorry I ramble.

---

<div class="post-metadata">

### Author: ![peli](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/peli/32/12_2.png) [@peli](https://forum.makecode.com/u/peli)
#### Post date: [October 9, 2019, 4:32am UTC](https://forum.makecode.com/t/makecode-set-strip-command-error/588/16 "2019-10-09T04:32:23Z")

</div>

An animation is an instance of a NeopixelAnimation class ( [https://github.com/microsoft/pxt-common-packages/blob/master/libs/light/neopixel.ts#L1235](https://github.com/microsoft/pxt-common-packages/blob/master/libs/light/neopixel.ts#L1235) ). This class can be subclassed to define any custom animation you wish (see Rainbow animation [https://github.com/microsoft/pxt-common-packages/blob/master/libs/light/neopixel.ts#L1247](https://github.com/microsoft/pxt-common-packages/blob/master/libs/light/neopixel.ts#L1247)).  
Once you have a subclass, declare a global variable that instantiates the animation object.  
[https://github.com/microsoft/pxt-common-packages/blob/master/libs/light/neopixel.ts#L1273](https://github.com/microsoft/pxt-common-packages/blob/master/libs/light/neopixel.ts#L1273) . Notice the special comments there specifically “fixedInstance” is needed.  
The last piece of the puzzle is to generate the icon image (.jres file) in your extension for your animation. It currently requires to run a CLI but maybe we can make it simpler.

---

<div class="post-metadata">

### Author: ![peli](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/peli/32/12_2.png) [@peli](https://forum.makecode.com/u/peli)
#### Post date: [October 9, 2019, 4:32am UTC](https://forum.makecode.com/t/makecode-set-strip-command-error/588/17 "2019-10-09T04:32:42Z")

</div>

Ignore the enum; it’s there for legacy.

---

<div class="post-metadata">

### Author: ![cantcodewell](https://avatars.discourse-cdn.com/v4/letter/c/3ec8ea/32.png) [@cantcodewell](https://forum.makecode.com/u/cantcodewell)
#### Post date: [October 9, 2019, 10:38pm UTC](https://forum.makecode.com/t/makecode-set-strip-command-error/588/18 "2019-10-09T22:38:21Z")

</div>

@KMSkelton I don’t know why you deleted your posts I found them informing and I will try what you mentioned. I was able to read them through email notification.

Thanks for the link peli. I appreciate both of you giving me some input

---

<div class="post-metadata">

### Author: ![KMSkelton](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/kmskelton/32/400_2.png) [@KMSkelton](https://forum.makecode.com/u/KMSkelton)
#### Post date: [October 10, 2019, 12:23am UTC](https://forum.makecode.com/t/makecode-set-strip-command-error/588/19 "2019-10-10T00:23:25Z")

</div>

I removed the posts because they weren’t accurate in light of Peli’s post. I was going to write an edit but the sysyem said I’d already made too many posts on this topic. At any rate… with the correct links (provided by Peli) the creation of the animations looks very straight forward. I’m pleased you found the explanations helpful

---

<div class="post-metadata">

### Author: ![cantcodewell](https://avatars.discourse-cdn.com/v4/letter/c/3ec8ea/32.png) [@cantcodewell](https://forum.makecode.com/u/cantcodewell)
#### Post date: [October 10, 2019, 1:55am UTC](https://forum.makecode.com/t/makecode-set-strip-command-error/588/20 "2019-10-10T01:55:42Z")

</div>

After digging into the links you gave me Peli, I realize most of the pixels are set with math. Which would mean I would somehow have to declare some constant for pixels 30-60 to be reversed so that when 30 is pulled it would actually activate 60. ect ect. Which I would also have to do for my own code also.

---

<div class="post-metadata">

### Author: ![peli](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/peli/32/12_2.png) [@peli](https://forum.makecode.com/u/peli)
#### Post date: [October 10, 2019, 2:56am UTC](https://forum.makecode.com/t/makecode-set-strip-command-error/588/21 "2019-10-10T02:56:09Z")

</div>

> [@cantcodewell](#):
>
> omehow have to declare some constant for pixels 30-60 to be reve

We also support “ranges”, see the `range(0, 30)` function. It returns a sub-strip instance and you can run animation/set color on those as needed. So you can use ranges to partition a long strip into various sections.
