There have been a few issues that I have come across while making led shows. First I made "Chase", which I didn't really have any issues with, because I used example code to make it. Although I did have to learn what unsigned variables are because the example code used them. Signed and unsigned variables of the same type both represent the same number of values however unsigned variables can only be positive, so for example, an unsigned byte can represent values from 0 to 255, while signed byte can represent -128 to 127. I also had to go +and learn how to make a for loop in arduino which I found out you need to pass three statements, the initialization statement, the end condition statement, and the increment statement. Next I made the "Bounce" function. I knew that while the chase was first going across the strip it would be the same as the normal chase. However, once it got to the end, I had to figure out how to make it stop and come back the other way. It took me a little bit to come up with the math but eventually I figured it out. All I had to do was run a normal chase but in its own for loop after the first one and make it run exactly backwards compared to the first chase, so I just basically flipped all the values I was using. Next I made the "DoubleBounce" function. It was relatively simple, all i had to do was make two chases that were going opposite of each other that, and I had to make sure they moved at the same time, which I could by putting them in the same for loop. However when making them bounce back I had some troubles. All I had to do was take the first and swap the colors between the two different lines that drew pixels, however I spent quite a bit of time trying to make some complicated math that would work, but eventually I figured it out. The next led show that I made was the "DoubleHalfBounce". This one was quite easy to make as I already knew how to make the "DoubleBounce", the only thing i needed to figure out was how to make the chases stop in the middle and then go back to the edges. I ended up getting over this by dividing my end condition by 2 so that the chases would stop in the very middle. I also had an issue where whenever i would push a button it would wait until the specific led show it was on finished and then it would switch. I ended up fixing this by throwing an if statement in each led show function that would forcibly end the function if the current case number didn't match up with what the current led show should be. I also had a problem where the leds from the previous led show would stay on until they were overwritten with the new led show. I fixed this by making a little function that would go through every led in the strip and set its colour values to 0 and I stuck this function in with the if statements that would end the led show functions.
0 Comments
Leave a Reply. |
What's Going on Here?This is Ethan's blog about the progress done on their Capstone Project (final project) for their Computer Science 30 course.
Resources UsedArduino Reference Page
Interrupt Reference Interrupt Millis Function Arduino Forum Page Adafruit Button Help Sub Reddit Button Help Example Code UsedThe Led ShowsMy ProjectClick Here to go and take a look at the code for my project and maybe even download and use it if you want.
|