all: add copy-code button

This adds a copy button on the Pybricks website.
This commit is contained in:
David Lechner
2021-04-28 19:05:01 -05:00
parent 8333ef3278
commit c24ff4bb2b
6 changed files with 7 additions and 0 deletions
@@ -30,6 +30,7 @@ This works by repeatedly:
The brick positions are given as the degrees the belt motor turns relative to
the base position. You can tweak these values by a few degrees if needed.
{% include copy-code.html %}
```python
{% include_relative main.py %}
```
@@ -32,6 +32,7 @@ Connect the motor to port A and connect the tilt sensor to port B.
This program makes the train drive until it detects a slope of 8 degrees or
more. Then it drives back down.
{% include copy-code.html %}
```python
{% include_relative main.py %}
```
@@ -48,6 +48,7 @@ speed without running off the line.
## Program
{% include copy-code.html %}
```python
{% include_relative main.py %}
```
@@ -19,6 +19,7 @@ This program centers the steering motor, and defines a function called
``drive`` which can be used to control the vehicle. Further details
are given as comments in the program.
{% include copy-code.html %}
```python
{% include_relative main.py %}
```
@@ -24,6 +24,7 @@ You can read keyboard presses using `stdin`, as shown in the example below.
Then you can make your program choose different behaviors based on which key
is pressed.
{% include copy-code.html %}
```python
{% include_relative remote.py %}
```
@@ -36,6 +37,7 @@ the [basic driving program](../driving). This allows you to control the
truck using the numeric keys on your keyboard. If your keyboard does not have
separate numeric keys, just adapt the program to use other keys.
{% include copy-code.html %}
```python
{% include_relative main.py %}
```
@@ -28,6 +28,7 @@ Mount the sensor somewhere on the front of your truck.
This program builds on the basic [driving example](../driving). It makes the
truck back up and turn when it detects an obstacle.
{% include copy-code.html %}
```python
{% include_relative main.py %}
```