60198-cargo-train: Update project.

This commit is contained in:
Laurens Valk
2021-04-13 16:38:50 +02:00
parent 5a8e6c0021
commit 7a36ba3631
7 changed files with 52 additions and 34 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 212 KiB

+9
View File
@@ -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."
---
@@ -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
Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

@@ -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