Skip to content

Latest commit

 

History

History
28 lines (18 loc) · 811 Bytes

README.md

File metadata and controls

28 lines (18 loc) · 811 Bytes

Train Control

This code controls a train motor using a PoweredUpHub and a speed value read from a file. The motor speed is updated whenever the value in the file changes.

Installation

To run this code, you will need to install the curio, bricknil, and bricknil_sensor packages. You can do this using pip:

pip install curio bricknil bricknil_sensor
python train.py

Launch WebAPI for the train

python server.py

To use the api_train API, you can make HTTP GET requests to the following URLs:

To use these APIs, you can open a web browser or use a tool like curl to make the HTTP requests. For example: