tools lessons (#1218)

* tools lessons

* updated summary

* more images

* wire up images

* fixing radio send-value
This commit is contained in:
Peli de Halleux 2018-09-12 13:26:39 -07:00 committed by GitHub
parent 5dde6947d3
commit d0a40d1ae1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 51 additions and 26 deletions

View File

@ -42,6 +42,9 @@
* [Stop Watch](/projects/stopwatch) * [Stop Watch](/projects/stopwatch)
* [Name Tag](/projects/name-tag) * [Name Tag](/projects/name-tag)
* [Step counter](/projects/step-counter) * [Step counter](/projects/step-counter)
* [Servo calibrator](/projects/servo-calibrator)
* [Analog Pin Calibrator](/projects/analog-pin-calibrator)
* [Light level calibrator](/projects/light-level-calibrator)
## #examples ## #examples

View File

@ -43,16 +43,6 @@ Here are some fun programs for your @boardname@!
"description": "Chart acceleration on the LED screen", "description": "Chart acceleration on the LED screen",
"url": "/examples/plot-acceleration", "url": "/examples/plot-acceleration",
"cardType": "example" "cardType": "example"
}, {
"name": "Plot Light Level",
"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",
"url": "/examples/plot-analog-pin",
"cardType": "example"
}, { }, {
"name": "Radio Dashboard", "name": "Radio Dashboard",
"description": "A dashboard for radio clients", "description": "A dashboard for radio clients",
@ -60,14 +50,3 @@ Here are some fun programs for your @boardname@!
"cardType": "example" "cardType": "example"
}] }]
``` ```
## Actuators
```codecard
[{
"name": "Servo Calibrator",
"description": "Calibrate a servo",
"url": "/examples/servo-calibrator",
"cardType": "example"
}]
```

View File

@ -1,6 +1,6 @@
# Plot Analog Pin # Analog Pin Calibrator
Use this program to graph the analog value on pin ``P0``, ``P1`` or ``P2``. Use this program to graph the analog value on pin ``P0``.
Press ``A`` to scroll the value on the screen. Press ``A`` to scroll the value on the screen.
```blocks ```blocks

View File

@ -0,0 +1,18 @@
# Light level Calibrator
Use this program to graph the light level.
Press ``A`` to scroll the value on the screen.
```blocks
let reading = 0
basic.forever(() => {
reading = input.lightLevel()
led.plotBarGraph(
reading,
255
)
if (input.buttonIsPressed(Button.A)) {
basic.showNumber(reading)
}
})
```

View File

@ -10,12 +10,12 @@ in a loop.
```blocks ```blocks
let angle = 90 let angle = 90
input.onButtonPressed(Button.A, () => { input.onButtonPressed(Button.A, () => {
angle -= Math.max(0, 5) angle = Math.max(0, angle - 5)
pins.servoWritePin(AnalogPin.P0, angle) pins.servoWritePin(AnalogPin.P0, angle)
led.stopAnimation() led.stopAnimation()
}) })
input.onButtonPressed(Button.B, () => { input.onButtonPressed(Button.B, () => {
angle += Math.min(180, 5) angle = Math.min(180, angle + 5)
pins.servoWritePin(AnalogPin.P0, angle) pins.servoWritePin(AnalogPin.P0, angle)
led.stopAnimation() led.stopAnimation()
}) })

25
docs/projects/tools.md Normal file
View File

@ -0,0 +1,25 @@
# Tools
## Calibration
```codecard
[{
"name": "Light Level Calibrator",
"description": "Calibrate light input",
"url": "/projects/light-level-calibrator",
"imageUrl": "/static/mb/projects/light-level-calibrator.png",
"cardType": "side"
}, {
"name": "Analog Pin Calibrator",
"description": "Calibrate analog input",
"url": "/projects/analog-pin-calibrator",
"imageUrl": "/static/mb/projects/analog-pin-calibrator.png",
"cardType": "side"
}, {
"name": "Servo Calibrator",
"description": "Calibrate a servo",
"url": "/projects/servo-calibrator",
"imageUrl": "/static/mb/projects/servo-calibrator.png",
"cardType": "side"
}]
```

View File

@ -32,7 +32,6 @@ Then it shows them on the LED screen.
```blocks ```blocks
radio.setGroup(99) radio.setGroup(99)
radio.onReceivedValue(function (name, value) { radio.onReceivedValue(function (name, value) {
radio.onDataPacketReceived(({ name, value }) => {
basic.showString(name); basic.showString(name);
basic.showNumber(value); basic.showNumber(value);
}); });

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -75,6 +75,7 @@
"Music": "projects/music", "Music": "projects/music",
"Toys": "projects/toys", "Toys": "projects/toys",
"Science": "projects/science", "Science": "projects/science",
"Tools": "projects/tools",
"Turtle": "projects/turtle", "Turtle": "projects/turtle",
"Examples": "examples" "Examples": "examples"
} }