From a4a74bdd6bde54109ccb247eaea3a0dcfb1a4007 Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Thu, 9 Feb 2017 17:40:21 -0800 Subject: [PATCH] adding a few more examples --- docs/examples.md | 20 ++++++++++++++++++++ docs/examples/blinky.md | 20 ++++++++++++++++++++ docs/examples/name-tag.md | 7 +++++++ docs/examples/plot-analog-pin.md | 10 ++++++++++ docs/examples/rando.md | 7 +++++++ 5 files changed, 64 insertions(+) create mode 100644 docs/examples/blinky.md create mode 100644 docs/examples/name-tag.md create mode 100644 docs/examples/plot-analog-pin.md create mode 100644 docs/examples/rando.md diff --git a/docs/examples.md b/docs/examples.md index f9659fd4..02328909 100644 --- a/docs/examples.md +++ b/docs/examples.md @@ -2,6 +2,23 @@ Here are some fun programs for your @boardname@! +## Fun stuff + +```codecard +[{ + "name": "Blinky", + "url":"/examples/blinky" +}, +{ + "name": "Name Tag", + "url":"/examples/name-tag" +}, +{ + "name": "Rando", + "url":"/examples/rando" +}] +``` + ## Sensors ```codecard @@ -11,5 +28,8 @@ Here are some fun programs for your @boardname@! }, { "name": "Plot Light Level", "url":"/examples/plot-light-level" +}, { + "name": "Plot Analog Pin", + "url":"/examples/plot-analog-pin" }] ``` diff --git a/docs/examples/blinky.md b/docs/examples/blinky.md new file mode 100644 index 00000000..067e4fa8 --- /dev/null +++ b/docs/examples/blinky.md @@ -0,0 +1,20 @@ +# Blinky + +```blocks +basic.forever(() => { + basic.showLeds(` + . # . # . + # # # # # + # # # # # + . # # # . + . . # . .` + ); + basic.showLeds(` + . . . . . + . . . . . + . . . . . + . . . . . + . . . . .` + ); +}) +``` \ No newline at end of file diff --git a/docs/examples/name-tag.md b/docs/examples/name-tag.md new file mode 100644 index 00000000..483f6b5d --- /dev/null +++ b/docs/examples/name-tag.md @@ -0,0 +1,7 @@ +# Name Tag + +```blocks +basic.forever(() => { + basic.showString("JAMES") +}) +``` \ No newline at end of file diff --git a/docs/examples/plot-analog-pin.md b/docs/examples/plot-analog-pin.md new file mode 100644 index 00000000..c9bc725a --- /dev/null +++ b/docs/examples/plot-analog-pin.md @@ -0,0 +1,10 @@ +# Plot Analog Pin + +```blocks +basic.forever(() => { + led.plotBarGraph( + pins.analogReadPin(AnalogPin.P0), + 1023 + ) +}) +``` diff --git a/docs/examples/rando.md b/docs/examples/rando.md new file mode 100644 index 00000000..da4399bd --- /dev/null +++ b/docs/examples/rando.md @@ -0,0 +1,7 @@ +# Rando + +```blocks +basic.forever(() => { + led.toggle(Math.random(5), Math.random(5)) +}) +``` \ No newline at end of file