In the figure below, what you see is a LEGO Spike Prime connected to two motors and a Rasberry Pi. The Raspberry PI hosts a server using the python library flask that has a custom Graphical User Interface. The webpage can be accessed by any desktop or laptop of mobile device on the same wifi by going to [Pi ip-address]:5000
. The graphical user interface also shown below consists of a wheel that can be used to control the direction that the car moves in and a slider that controls the velocity of the car. The inputs are taken from the webpage and communicated from the Raspberry PI to the Lego SPIKE PRIME using serial communication. The SPIKE PRIME then parses the user input into a motor response (i.e. increasing/decreasing the motors to speed up/slow down or their relative speeds to turn)
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
-
A LEGO SPIKE PRIME Kit Purchase One Here.
Simply download the files in this repository and first run the code on the WIO Terminal using the Arduino IDE. Then run the SPIKE PRIME Code in REPL or the IDE that can be found here, SPIKE PRIME IDE. To run the PI code, use flask run --host=0.0.0.0
. The file must be named app.py
. This will start a webpage on your Raspberry Pi being served to port 5000.
- Sawyer Bailey Paccione - Raspberry PI CODE, SPIKE CODE - Portfolio
This project is licensed under the MIT License - see the LICENSE file for details