In this week’s challenge, our goal was to learn use the random function, custom embedded functions, for loops and if statements to create a random dice roll and then count the distribution of dice rolls.
2. Code:
The following code displays a random dice roll on a 7-LED array and counts the distribution of rolls for 100 dice rolls.
3. Circuit Design:
For the following circuit design, the 7 LED's are arranged so a to display the typical dice number arrangements from 1 through 6 for each random number that is generated.
Video of Circuit for Random Dice Roller (0:25)
4. Electronic Diagram:
The following electronic diagrams were taken from my design journal.
For the following circuit design, the potentiometer functions as a color selector. Turning the knob on the potentiometer will determine which color the RGB LED will shine.
Electronic Diagram for Random Dice Roller
5. Video of Project:
Description of Project to Create Random Dice Roller (2:52)
6. Explanation of Project:
I started this week by learning how to use the random() function to generate the integers 1 through 6. I initially plugged in 6 as the "max". However, using the serial.print output, I was able to quickly discover that this only generated numbers 1 through 5 and corrected my mistake by changing the "max" to 7. This correctly generated the random numbers I wanted.
Next, I wrote a function to take the random dice number and display it on my 7-LED arrangement. This took a little troubleshooting on the syntax of my if statements, but it looked really cool once it started working!
Finally, I automated the counting process to track how many times I rolled a 1, 2, 3, 4, 5 or 6 in 100 rolls. I then displayed that using the serial.print function so that I could graph it when I was done!
7. Reflection:
This week was a lot of trial and error. I decided to challenge myself by starting my code completely from scratch without any references or guides. I was able to learn more about how integer variables work, how to use for and while loops, and how to use embedded functions to reduce the amount of repetitive coding I would need to do. It think this will help me be more efficient in the future.
8. Applications:
A very obvious application for this would be the computerized slot machines at casinos. It makes you wonder how fair these machines actually are, and what random seeds they use as their input to their random functions. I'm sure someone monitors their code... I would hope! But it seems like a giant loophole for casinos to make more money!
9. Graph of Dice Roller Distribution
Below is the graph of my dice roller number distribution for 100 rolls.
1) Project: This blog post follows my initial exploration of my Arduino Super Starter Kit as I attempt to complete the "blinking led" project. The goal is to use the Arduino IDE interface to write code for a blinking LED, build a circuit using my Arduino, breadboard, wires and LEDs, upload my code to my Arduino, and then explore different variations and possibilities in the realm of blinking LEDs. Video 1: Unpacking my Arduino Kit! 2) Code: Here is a screenshot of my annotated code for the blinking LED project. 3) Circuit Design: Here is a video showing the circuit I built using my Arduino and breadboard. Video 2: Circuit for Blinking LED Challenge 4) Electronic Diagram: Below is the electronic diagram from my design journal: 5) Video of Project: While not necessarily a "successful" implementation of this week's assigned project. I learned a lot about how to trouble shoot Arduino connections issues, which will hopefully save me time and headaches in the future ...
1. Project: In this week’s challenge, our goal was to use the potentiometer in our Arduino kit to create blinking speed controller for our LED and then modify our circuit and code to create a dimmer switch for our LED . My potentiometer looked slightly different from the ones in the tutorials. However, the same principle applied: two poles of the potentiometer connected to high (5V) and low (0V) voltage and the potentiometer acted as a variable resistor (or voltage divider) providing a set voltage between 0 and 5V to the middle pin, depending on the position to which the dial was turned. 2. Code: The following code can be used to control either the brightness or the blink speed of an LED, depending on the circuit design used with the code. When the positive side of the LED is connected to Pin 13, the potentiometer controls the blink speed. When the positive side of the LED is connected to the variable output of the potentiometer, the potentiometer controls ...
This week I playtested technologies specifically designed to support learning Middle School science content. In doing so, I identified the following and discuss the affordances and drawbacks I see in each one: Gizmos from Explore Learning offers hundreds of interactive labs, simulations, design challenges and more for math and science topics from elementary through high school. One of my favorite virtual labs to do with my students is the Digestive System Gizmo . As the students explore each organ in the digestive tract, they can adjust variables to try to get stool with the right consistency. (Complete with sound effects when the consistency is off!!) While I applaud Ms. Frizzle's "Get messy!" pedagogy, I believe this lab works much better as a virtual simulation than an in-person investigation. Example 1: (Redefinition Level) Students use the Digestive System Gizmos simulation to conduct a virtual lab activity. Students are given a chance to explore and experiment b...
Comments
Post a Comment