# molecule13

79

## Achievements

10K+ Views Earned a bronze medal
Contest Winner Runner Up in the Halloween Decor Contest 2015
Contest Winner Third Prize in the Make It Glow! Contest
Show 2 More »
• molecule13 commented on molecule13's instructable How to Make a Lightning Cloud8 months ago

• molecule13 commented on molecule13's instructable How to Make a Lightning Cloud8 months ago

Sure. The way this works is I set a "chance" variable to either 5 (high strike likelihood) or 10 (low strike likelihood). The chance variable gets passed into the "random" function. We can see in the arduino documentation[1] that when the "random" function takes one argument, that argument is the "maximum" value. So it'll return a random number between 0 and that maximum value minus one. In other words random(chance) in English is: "a random number between zero and chance minus one". So if chance is set to 10 it'll return a random number between 0 and 9, and if chance is set to 5 it'll return a random number between 0 and 5. Let's look at the whole line[2] and interpret it into English: if (random(chance) == 3)if ( the random number betw...

see more »

Sure. The way this works is I set a "chance" variable to either 5 (high strike likelihood) or 10 (low strike likelihood). The chance variable gets passed into the "random" function. We can see in the arduino documentation[1] that when the "random" function takes one argument, that argument is the "maximum" value. So it'll return a random number between 0 and that maximum value minus one. In other words random(chance) in English is: "a random number between zero and chance minus one". So if chance is set to 10 it'll return a random number between 0 and 9, and if chance is set to 5 it'll return a random number between 0 and 5. Let's look at the whole line[2] and interpret it into English: if (random(chance) == 3)if ( the random number between 0 and chance is equal to 3) ...then do the next thing. So, if you want to make it more likely all you have to do is make that statement something that's more likely to happen. So if you want it to do a lightning strike 50% of the time, you might change it to:chance = 1if (random(chance) == 0)The only options for a random number between 0 and 1 are 0 and 1! So 50% of the time (on average) you'll get a lightning strike.The other thing you might want to change for a more "electricity" effect is the delay between strikes (make the number here smaller): https://github.com/molecule/cloud-lightning/blob/v1.0/cloud-lightning/cloud-lightning.ino#L104Or the delay between the flashes in the ligthningStrike itself (make the max number here smaller too):https://github.com/molecule/cloud-lightning/blob/v1.0/cloud-lightning/cloud-lightning.ino#L120For this part, you'll really just have to mess around with the code until it looks like you want it to look! I don't have any special knowledge that lets me design this: I just played around until I liked it. I hope you'll share your changes with us when you're finished! I'd love to see a video of the completed project. Good luck :)[1] https://www.arduino.cc/en/Reference/Random[2] https://github.com/molecule/cloud-lightning/blob/c3af10c57ad2d1b4f775eebefa147384399d5827/cloud-lightning/cloud-lightning.ino#L90

1. To know that it is uploaded correctly, you should see this message at the bottom of the print outs of your Arduino IDE: https://www.dropbox.com/s/hs6hnvu6xhmmn0p/Screensh...If you don't see that confirmation message, you might not have uploaded successfully! But remember, I can't help you if you don't post the error messages you're getting...so if you want help, be sure to always include all the information! Also tell me what kind of Arduino board you're using.2. Check out Step 4 for how to wire everything up! What you have does not sound correct to me.

• molecule13 commented on molecule13's instructable How to Make a Lightning Cloud9 months ago

The three most important errors are shown at the bottom again, just like last time:C:\Program Files (x86)\Arduino\libraries\Cloud-Lightning\cloud-lightning.ino: In function 'void setup()':cloud-lightning:85: error: 'simple_moving_average' was not declared in this scopefunctionPtrs[0] = simple_moving_average;^cloud-lightning:86: error: 'random_moving_average' was not declared in this scopefunctionPtrs[1] = random_moving_average;^C:\Program Files (x86)\Arduino\libraries\Cloud-Lightning\cloud-lightning.ino: At global scope:cloud-lightning:127: error: expected unqualified-id before ')' token})Those look.....strange. I encourage you to download the code again from my github account: this looks like a copy-and-paste problem.You're also getting complaints from the IDE about your file structure...

see more »

The three most important errors are shown at the bottom again, just like last time:C:\Program Files (x86)\Arduino\libraries\Cloud-Lightning\cloud-lightning.ino: In function 'void setup()':cloud-lightning:85: error: 'simple_moving_average' was not declared in this scopefunctionPtrs[0] = simple_moving_average;^cloud-lightning:86: error: 'random_moving_average' was not declared in this scopefunctionPtrs[1] = random_moving_average;^C:\Program Files (x86)\Arduino\libraries\Cloud-Lightning\cloud-lightning.ino: At global scope:cloud-lightning:127: error: expected unqualified-id before ')' token})Those look.....strange. I encourage you to download the code again from my github account: this looks like a copy-and-paste problem.You're also getting complaints from the IDE about your file structure. It looks like you have a folder called "Cloud-Lightning" in the Arduino/libraries folder. I am assuming Cloud-Lightning refers to the code for this project, in which case the "libraries" folder is not the right place for it! Move it up one level so it's just in the "Arduino" folder.

• molecule13 commented on molecule13's instructable How to Make a Lightning Cloud9 months ago

Hmm, well you're getting a compile error (I can tell because the message you helpfully provided says "Error compiling for board"). That means that, as the compiler is trying to make the code into machine-understandable language, something went wrong. To understand what, we need more information! First, turn on the verbose messages for compiling in your IDE:File->Preferences->Show verbose output during:. Tick boxes for compilation and upload.Then try to compile again. You should get a LOT more information, and some of it will be useful :) In particular, I'm guessing you're missing one of the libraries you need to install (or you didn't restart the IDE after installing them). But we should be able to tell with more information.

Excellent! This is everything we need to figure this out. Typically, for compile errors, you want to look at the "first" error. Arduino helpfully puts that at the very end of the compile error, and I've copied it here for convenience:fatal error: Adafruit_NeoPixel.h: No such file or directoryThat basically means that you haven't installed or successfully set up the Neopixel library! So Arduino has no idea where that code is. The good news is, it's super easy to fix this. Head on over to Adafruit's excellent (as always) tutorial on installing the Neopixel library and you should be able to get past this error! Here's the link:https://learn.adafruit.com/adafruit-neopixel-uberguide/arduino-library-installation

• molecule13 commented on molecule13's instructable How to Make a Lightning Cloud9 months ago

You're very welcome! I'm sorry the drivers were a challenge, but nice job on getting it all worked out! And yes: there is a way to adjust the colors of the neopixels :) Here's the relevant line of code:https://github.com/molecule/cloud-lightning/blob/m...strip.Color is one of several methods used to change the color of a certain pixel! It takes either two argument (as in my code, linked above), or four arguments (as in the Adafruit tutorial, linked below). They're really the same: they just take the same arguments in different forms. Let's look first at the four argument version.The first argument is "n", the pixel that you want to change. The next argument is the red value, the third argument is the green value, and the last argument is the blue value. When you're building a ...

see more »

You're very welcome! I'm sorry the drivers were a challenge, but nice job on getting it all worked out! And yes: there is a way to adjust the colors of the neopixels :) Here's the relevant line of code:https://github.com/molecule/cloud-lightning/blob/m...strip.Color is one of several methods used to change the color of a certain pixel! It takes either two argument (as in my code, linked above), or four arguments (as in the Adafruit tutorial, linked below). They're really the same: they just take the same arguments in different forms. Let's look first at the four argument version.The first argument is "n", the pixel that you want to change. The next argument is the red value, the third argument is the green value, and the last argument is the blue value. When you're building a color, you'll decide how much of that color you want to be seen for each LED. So, if you wanted to make purple, you might pass in even amounts of red and blue, and zero green:strip.setPixelColor(pixel, strip.Color(50, 0, 50));Whereas if you wanted to do turquoise, or any kind of teal/blue/green mixture, you would pass in some amount of green and some amount of blue, and zero red:strip.setPixelColor(pixel, strip.Color(0, 20, 50));All mixtures will create a color, you just have to experiment until you find the right amount of mixture for the colors you want. Right now in my code, every value passed in to strip.Color is the same: strip.setPixelColor(pixel, strip.Color(scaledWhite, scaledWhite, scaledWhite));That means the LEDs will flash white. I hope that this little extra bit of information helps you!To learn even more, I highly recommend Adafruit's learning system! https://learn.adafruit.com/adafruit-neopixel-uberg...

• molecule13 commented on molecule13's instructable How to make a Lightning Cloud1 year ago

Sorry this response is so late! I just now found out that Instructables doesn't seem to email you about every comment, so I didn't realize a lot of these were here until just today.Anyway, in your picture I can't see where the red, green, or yellow wires are going. I'm suspicious that the green and yellow in particular are not hooked up correctly. I'm also very concerned that you don't seem to have any wire connected to ground. Can you post a picture with the entire circuit visible? (Or maybe by now you've moved on, which would be understandable :) ).

• molecule13 commented on molecule13's instructable How to make a Lightning Cloud1 year ago

In the video of the cloud, I was using a Pro Trinket!Also, it's not a dumb question but I'm not sure I totally understand it well enough to give a good answer. Here are some guesses about what you mean, and answers:Do you mean why does the code work on both? Many different Arduino board are compatible, meaning the same code will work on different boards. In some cases you need to change pins, or remove functionality that isn't there, or shrink the size of the sketch for a smaller board, but for the most part the same code will work everywhere. That's the case here: this code will work without changes on both the Pro Trinket and the Uno.Do you mean literally how do I transfer it? The code lives on the computer, so to put it onto a Pro Trinket, I just plug the pro trinket into the compute...

see more »

In the video of the cloud, I was using a Pro Trinket!Also, it's not a dumb question but I'm not sure I totally understand it well enough to give a good answer. Here are some guesses about what you mean, and answers:Do you mean why does the code work on both? Many different Arduino board are compatible, meaning the same code will work on different boards. In some cases you need to change pins, or remove functionality that isn't there, or shrink the size of the sketch for a smaller board, but for the most part the same code will work everywhere. That's the case here: this code will work without changes on both the Pro Trinket and the Uno.Do you mean literally how do I transfer it? The code lives on the computer, so to put it onto a Pro Trinket, I just plug the pro trinket into the computer and hit "upload". Feel free to ask follow-ups if I didn't understand your question the first time!

Thanks for the recipe! I rolled my cookies to about 1/8" thick, baked them for 8 minutes (I was seeing some bubbling that interfered with the smooth surface at 10 mins), and did the strongest "vector engrave" setting on my lasercutter. Turned out great! The taste is not so good (tastes like extremely burnt sugar), but it's the thought that counts :)

• Thanks for the recipe! I rolled my cookies to about 1/8" thick, baked them for 8 minutes (I was seeing some bubbling that interfered with the smooth surface at 10 mins), and did the strongest "vector engrave" setting on my lasercutter. Turned out great! The taste is not so good (tastes like extremely burnt sugar), but it's the thought that counts :)

• molecule13 commented on molecule13's instructable How to make a Lightning Cloud1 year ago

Hi! Glad to hear you had a good time and the code was user friendly.For the power issue...the fact that it's switching itself off sounds almost like a safety mechanism...are you shorting the power somehow? You'd need to post some pictures or a wiring diagram (or both) to get more help, though.