diff --git a/sets/city/60198-cargo-train/60198-cargo-train.jpg b/sets/city/60198-cargo-train/60198-cargo-train.jpg new file mode 100644 index 0000000..e3ecb6a Binary files /dev/null and b/sets/city/60198-cargo-train/60198-cargo-train.jpg differ diff --git a/sets/city/60198-cargo-train/README.md b/sets/city/60198-cargo-train/README.md new file mode 100644 index 0000000..9323754 --- /dev/null +++ b/sets/city/60198-cargo-train/README.md @@ -0,0 +1,9 @@ +--- +permalink: /projects/sets/city/60198-cargo-train/ +title: "Cargo train" +image: + local: "60198-cargo-train.jpg" + credit: "LEGO" +layout: set +description: "Python projects that apply to most modern LEGO trains." +--- diff --git a/sets/city/60198-cargo-train/slope-detection/README.md b/sets/city/60198-cargo-train/slope-detection/README.md new file mode 100644 index 0000000..f590c22 --- /dev/null +++ b/sets/city/60198-cargo-train/slope-detection/README.md @@ -0,0 +1,43 @@ +--- +permalink: /projects/sets/city/60198-cargo-train/slope-detection/ +title: "Train slope detection" +maintainer: + user: "pybricks" + name: "The Pybricks Authors" +image: + local: "slope-detection.jpg" +video: + youtube: "https://www.youtube.com/embed/Wc0mRIBjhIU" +description: + "Detect the slope of the track. This lets you determine where the train + is on the circuit." +building_instructions: + external: https://www.lego.com/en-us/service/buildinginstructions/60198 +--- + +## Building instructions +Build the train using the standard instructions. Mount the +[tilt sensor][tiltsensor] +horizontally in the train, with the cable side facing towards direction of +driving: + +![](sensor-placement.jpg) + +Connect the motor to port A and connect the tilt sensor to port B. + +## Coding Instructions + + + +This program makes the train drive until it detects a slope of 8 degrees or +more. Then it drives back down. + +```python +{% include_relative main.py %} +``` + +## Programming and running instructions +The train must start on a horizontal track. Then run the program. + +[tiltsensor]: https://docs.pybricks.com/en/latest/pupdevices/tiltsensor.html + diff --git a/sets/city/generic/slope_detection/slope.py b/sets/city/60198-cargo-train/slope-detection/main.py similarity index 100% rename from sets/city/generic/slope_detection/slope.py rename to sets/city/60198-cargo-train/slope-detection/main.py diff --git a/sets/city/60198-cargo-train/slope-detection/sensor-placement.jpg b/sets/city/60198-cargo-train/slope-detection/sensor-placement.jpg new file mode 100644 index 0000000..504e499 Binary files /dev/null and b/sets/city/60198-cargo-train/slope-detection/sensor-placement.jpg differ diff --git a/sets/city/60198-cargo-train/slope-detection/slope-detection.jpg b/sets/city/60198-cargo-train/slope-detection/slope-detection.jpg new file mode 100644 index 0000000..0903d49 Binary files /dev/null and b/sets/city/60198-cargo-train/slope-detection/slope-detection.jpg differ diff --git a/sets/city/generic/slope_detection/README.md b/sets/city/generic/slope_detection/README.md deleted file mode 100644 index 4a8aa2a..0000000 --- a/sets/city/generic/slope_detection/README.md +++ /dev/null @@ -1,34 +0,0 @@ -# Rail slope detection - -Made by: The Pybricks Authors - -## Introduction - -This project shows how you can integrate the -[Tilt Sensor][tiltsensor] -in your LEGO trains. You can use this sensor to detect a slope in the rail -track. - -## Demo - -This program makes the train drive until it detects a slope of 8 degrees or -more. Then it drives back down. You can watch a video -[here](https://www.youtube.com/watch?v=Wc0mRIBjhIU). - -## Requirements -- Generic LEGO train, such as 60197 or 60198 -- Powered Up [Tilt Sensor][tiltsensor] - -## Building instructions -Build the train using the standard instructions. Mount the Tilt Sensor anywhere -on the train. See the video for an example. Mount it horizontally. The side -with the cable should face towards the front: in the direction of driving. - -## Ports -- Train motor on port A -- Tilt sensor on port B - -## Programming and running instructions -The train must start on a horizontal track. Then run the program. - -[tiltsensor]: https://docs.pybricks.com/en/latest/pupdevices/tiltsensor.html