Add info to some examples (#716)
* Add info to some examples * Push a few more descriptions * Couple more * Touch up card descriptions * Fix 'drop' typo * Live typo
This commit is contained in:
parent
93163ee226
commit
6398d60b3b
@ -7,7 +7,7 @@ Here are some fun programs for your @boardname@!
|
||||
```codecard
|
||||
[{
|
||||
"name": "Blinky",
|
||||
"description": "A blinking LED",
|
||||
"description": "A blinking pattern of LEDs",
|
||||
"url":"/examples/blinky",
|
||||
"cardType": "example"
|
||||
},
|
||||
@ -25,7 +25,7 @@ Here are some fun programs for your @boardname@!
|
||||
},
|
||||
{
|
||||
"name": "Game of Life",
|
||||
"description": "Simulation in LEDs. Use button A for next stage. Button B for reset.",
|
||||
"description": "A Game of Life simulation in LEDs",
|
||||
"url":"/examples/gameofLife",
|
||||
"cardType": "example"
|
||||
},
|
||||
@ -48,27 +48,27 @@ Here are some fun programs for your @boardname@!
|
||||
"cardType": "example"
|
||||
},{
|
||||
"name": "Plot Acceleration",
|
||||
"description": "chart acceleration on the LED screen",
|
||||
"description": "Chart acceleration on the LED screen",
|
||||
"url":"/examples/plot-acceleration",
|
||||
"cardType": "example"
|
||||
}, {
|
||||
"name": "Plot Light Level",
|
||||
"description": "chart light level on the LED screen",
|
||||
"description": "Chart light level on the LED screen",
|
||||
"url":"/examples/plot-light-level",
|
||||
"cardType": "example"
|
||||
}, {
|
||||
"name": "Plot Analog Pin",
|
||||
"description": "chart analog input on the LED screen",
|
||||
"description": "Chart analog input on the LED screen",
|
||||
"url":"/examples/plot-analog-pin",
|
||||
"cardType": "example"
|
||||
}, {
|
||||
"name": "Stop Watch",
|
||||
"description": "easy time tracking",
|
||||
"description": "Easily track time",
|
||||
"url":"/examples/stop-watch",
|
||||
"cardType": "example"
|
||||
}, {
|
||||
"name": "Radio Dashboard",
|
||||
"description": "dashboard for radio clients",
|
||||
"description": "A dashboard for radio clients",
|
||||
"url":"/examples/radio-dashboard",
|
||||
"cardType": "example"
|
||||
}]
|
||||
@ -79,7 +79,7 @@ Here are some fun programs for your @boardname@!
|
||||
```codecard
|
||||
[{
|
||||
"name": "Servo Calibrator",
|
||||
"description": "calibrates a servo",
|
||||
"description": "Calibrate a servo",
|
||||
"url":"/examples/servo-calibrator",
|
||||
"cardType": "example"
|
||||
}]
|
||||
@ -90,17 +90,17 @@ Here are some fun programs for your @boardname@!
|
||||
```codecard
|
||||
[{
|
||||
"name": "Turtle Square",
|
||||
"description": "move in a square",
|
||||
"description": "Move in a square",
|
||||
"url":"/examples/turtle-square",
|
||||
"cardType": "example"
|
||||
}, {
|
||||
"name": "Turtle Spiral",
|
||||
"description": "move in a spiral",
|
||||
"description": "Move in a spiral",
|
||||
"url":"/examples/turtle-spiral",
|
||||
"cardType": "example"
|
||||
}, {
|
||||
"name": "Turtle Scanner",
|
||||
"description": "scans the screen down",
|
||||
"description": "Scan down the screen",
|
||||
"url":"/examples/turtle-scanner",
|
||||
"cardType": "example"
|
||||
}]
|
||||
|
@ -1,5 +1,7 @@
|
||||
# Blinky
|
||||
|
||||
Flash a pattern on the LEDs.
|
||||
|
||||
```blocks
|
||||
basic.forever(() => {
|
||||
basic.showLeds(`
|
||||
|
@ -1,5 +1,9 @@
|
||||
# Egg and Spoon race
|
||||
|
||||
The [Egg and Spoon](https://en.wikipedia.org/wiki/Egg-and-spoon_race) race is a game where a player carries an object (like an egg) across some distance without it falling out of a holder. In the case of the Egg and Spoon, the player must carefully walk with an egg held in a spoon. The egg must remain in the spoon until the player crosses the finish line. The egg can easily roll out of the spoon so the player needs skill and patience to balance the egg until finishing the race.
|
||||
|
||||
You can program your @boardname@ to be an egg and let your hand be the spoon. If you walk too fast or waver in holding the @boardname@, you might "drop the egg!". Try to keep the balance point in the center of the screen.
|
||||
|
||||
```blocks
|
||||
let accY = 0
|
||||
let accX = 0
|
||||
@ -24,5 +28,4 @@ basic.forever(() => {
|
||||
})
|
||||
x = 2
|
||||
y = 2
|
||||
|
||||
```
|
||||
|
@ -1,4 +1,21 @@
|
||||
# Game of Life simulation in LEDs
|
||||
# Game of Life
|
||||
|
||||
The [Game of Life](https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life) simulates life in a grid world (a two-dimensional block of cells). The cells in the grid have a state of "alive" or "dead". The game starts with a population of cells placed in a certain pattern on the grid. A simulation is run, and based on some simple rules for life and death, cells continue to live, die off, or reproduce.
|
||||
|
||||
## Rules for Life
|
||||
|
||||
The rules for life in the grid are:
|
||||
|
||||
1. A living cell with less than two live cells next to it will die. This is underpopulation, no social support.
|
||||
2. A living cell with two or three live cells next to it continues to live. This is a healthy population.
|
||||
3. A living cell with more than three live cells next to it will die. This is over overpopulation, scarce resources.
|
||||
4. A dead cell with three live cells next to it turns into a living cell. This is reproduction.
|
||||
|
||||
Depending on the pattern of living cells at the start of the game, some population simulations may survive longer than others.
|
||||
|
||||
## Game of Life simulation in LEDs
|
||||
|
||||
A simulation of life in the LED matrix. Use button ``A`` for the next stage of life and button ``B`` to reset.
|
||||
|
||||
```blocks
|
||||
//https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life
|
||||
|
@ -1,5 +1,7 @@
|
||||
# Name Tag
|
||||
|
||||
Scroll your name across the screen.
|
||||
|
||||
```blocks
|
||||
basic.forever(() => {
|
||||
basic.showString("JAMES")
|
||||
|
@ -4,13 +4,13 @@ Approximate the value of **pi** using your @boardname@!
|
||||
|
||||
## Thinking about it...
|
||||
|
||||
Ok, let's pretend that a circle fits inside a square where the edge of the circle touches the sides of the square. If we say that the radius, called ``r``, of circle is `1` then the length of each side of the square is `2`, or ``2 * r``. The area of the circle is ``(pi * r) ** 2`` and the area of the square then is ``(pi * r * 2) ** 2``. We don't know what ``pi`` is so we can arrange a relationship between the area of the circle and the area of the square to solve for the value of ``pi``.
|
||||
Ok, let's pretend that a circle fits inside a square where the edge of the circle touches the sides of the square. If we say that the radius, called ``r``, of circle is `1` then the length of each side of the square is `2`, or ``2 * r``. The area of the circle is ``pi * (r ** 2)`` and the area of the square then is ``(r * 2) ** 2``. We don't know what ``pi`` is so we can arrange a relationship between the area of the circle and the area of the square to solve for the value of ``pi``.
|
||||
|
||||
### Circle and square
|
||||
|
||||
An interesting relationship between the circle and the square is that the area of the circle divided by the area of the square is:
|
||||
|
||||
``area ratio = ((pi * r) ** 2) / ((pi * r * 2) ** 2) = pi / 4``
|
||||
``area ratio = (pi * (r ** 2)) / ((r * 2) ** 2) = pi / 4``
|
||||
|
||||
Well, we can see that if we knew the area of both the circle and the square we could find out what the value of ``pi`` is! It's simply this:
|
||||
|
||||
@ -41,7 +41,7 @@ Of course, we can't completely fill the area of both shapes with dots but we cou
|
||||
|
||||
### Making and counting dots
|
||||
|
||||
To make the "dots" we can randomly make a value and see if it would fit as a coordinate with in the shape we're trying to fill. If it fits, increase the count of dots and try to make more for some amount of time. The more dots created, the better the accuracy of our value for ``area ratio``.
|
||||
To make the "dots" we can randomly make a value and see if it would fit as a coordinate within the shape we're trying to fill. If it fits, increase the count of dots and try to make more for some amount of time. The more dots created, the better the accuracy of our value for ``area ratio``.
|
||||
|
||||
### Monte Carlo method
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
# Plot Acceleration
|
||||
|
||||
Plot acceleration in the ``x`` dimension on the LEDs.
|
||||
|
||||
```blocks
|
||||
basic.forever(() => {
|
||||
led.plotBarGraph(
|
||||
|
@ -1,5 +1,7 @@
|
||||
# Plot Light level
|
||||
|
||||
Show the current light level as a bar graph.
|
||||
|
||||
```blocks
|
||||
basic.forever(() => {
|
||||
led.plotBarGraph(
|
||||
|
@ -1,5 +1,7 @@
|
||||
# Rando
|
||||
|
||||
Generate a random coordinate and display it on the LED screen.
|
||||
|
||||
```blocks
|
||||
basic.forever(() => {
|
||||
led.toggle(Math.random(5), Math.random(5))
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Stop watch
|
||||
|
||||
Press ``A`` to start the counter and
|
||||
Press ``A`` to start the counter. Press ``A`` again to stop and display the count.
|
||||
|
||||
```blocks
|
||||
let msec = 0
|
||||
|
Loading…
Reference in New Issue
Block a user