As I sat down to work this week, I was hoping to knock my work out early and have the rest of the week for holidays with the family, but you know what they say about the best-laid plans. It was not as easy to compartmentalize my life as my mind had imagined.
Setting up the Arduino circuit went fairly well. I started with my dancing lights extension project from last week. I needed to start with something I knew and felt comfortable with. My first step was to get the breadboard set up like a die and the lights working on both sides of the breadboard. Through research, I learned to connect the two sides together with jump wires - negative to negative and positive to positive.
![]() |
Since I was sort of starting from scratch on the design, I needed to draw out my plan. |
Once I learned how to connect the two sides, I repositioned the LEDs into the shape of a die, then I ran the dancing lights code again to be sure the lights would work on both sides of the breadboard. Tada! It worked!
The next part of my project involved getting the lights to light up like a die. Even after watching this week's videos, I am still struggling to understand the code. Several of our classmates found a random led number project, but the LEDs were in a line, not the shape of a die. I was able to copy the code and adjust it by changing the pin locations. I do understand that much about the code. When I first started running the code, I realized it wasn't lighting up like a die because I had didn't have the right HIGH and LOW for the die positions. I was able to fix that on my own. Yay! The beginning of the code initializes the seven LED pins and the button. The next part of the code sets up the LEDs as OUTPUT and the button as INPUT. The loop part of code sets is a random number generator and the different cases call the correct lights to turn on for each number in the spots on the die.
And here is where the holidays and family got all mixed up with the grad school work. I really wanted the lights to dance before they landed on the random number, but I could never figure out how to make that work. I recorded the video you'll see below and THOUGHT I had posted it to the group for advice, but apparently, I did not. My daughter called and needed some mom time and my son, who lives is in Lubbock, flew in for the holiday, and Thanksgiving dinner needed preparing. My bonus daughter wasn't able to spend Thanksgiving with us so we had a family outing at Top Golf. Once the family time took over, I kind of forgot about school 🤷♀️. Once I figured out I had missed an assignment, I began to wonder how I managed the holidays and grad school last year - but guess what? I didn't! I started grad school in the spring. This is all new, but I'm figuring it out. So, here's the video I thought I posted. It is showing the code works to generate random numbers at the click of the button in the different shapes of a die. If anyone would like to share how to add the dancing light code with the code I have, I would love to know how to make it happen.
Here is the graph of the numbers generated from one hundred rolls.
I hope you all had a wonderful Thanksgiving! Happy tinkering this week!
![]() |
It's been a long time since we have all been together! This mama's heart is happy. |
No comments:
Post a Comment