pibot:lesson1:softwaremac
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
pibot:lesson1:softwaremac [2021/10/09 20:49] – Fixed typos jstruebel | pibot:lesson1:softwaremac [2022/10/20 19:53] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Software Setup ====== | ||
+ | - Use the Raspberry Pi Imager utility to program the Raspberry Pi OS image to the microSD card as shown below. | ||
+ | - Insert the microSD card in the microSD card reader and plug the microSD card reader into the computer\\ \\ <WRAP box>{{ : | ||
+ | - Open the Raspberry Pi Imager from the Applications directory on the Flash drive | ||
+ | - Select the " | ||
+ | - Select the " | ||
+ | - Select the " | ||
+ | - Select the " | ||
+ | - Select the microSD card\\ \\ <WRAP round tip>The size of the microSD card should be approximately 16GB</ | ||
+ | - Hold down the Shift + Control + X keys at the same time to open the Advanced options window | ||
+ | - Click the box next to the "Set hostname:" | ||
+ | - Click the box next to the " | ||
+ | - Scroll down, click the box next to the " | ||
+ | - Scroll down, click the box next to the "Set locale settings" | ||
+ | - Click the Save button to close the Advanced options window and return to the main window | ||
+ | - Select the " | ||
+ | - Click the " | ||
+ | - When the Raspberry Pi Imager utility has finished, click the " | ||
+ | - Remove the microSD card reader from the computer | ||
+ | - Remove the microSD card from the microSD card reader and plug it into the Raspberry Pi board as shown below\\ \\ <WRAP box>{{ : | ||
+ | - Install charged 18650 batteries in the 18650 battery box and slide the switch to the " | ||
+ | - Wait 3-5 minutes for the green light to stop flashing | ||
+ | - Open the terminal app\\ \\ <WRAP round tip> | ||
+ | - Type the following command and press enter to clear out any previous SSH host keys\\ \\ <WRAP round important> | ||
+ | - Type the following command and press enter to import the new SSH host keys\\ \\ <WRAP round important> | ||
+ | - Type the following command and press enter to connect to the Raspberry Pi terminal via SSH\\ \\ <WRAP round important> | ||
+ | - Perform the following steps to enable the I2C interface on the Raspberry Pi board | ||
+ | - Type the following command and press enter to run the Raspberry Pi configuration utility\\ \\ < | ||
+ | - Use the up and down arrow keys to select the " | ||
+ | - Use the up and down arrow keys to select the " | ||
+ | - Use the left and right arrow keys to select the " | ||
+ | - Select the " | ||
+ | - Use the left and right arrow keys to select the " | ||
+ | - Type the following commands and press enter after each line to install the rpi.GPIO library and the PIP3 application\\ \\ <WRAP round tip> | ||
+ | sudo apt-get upgrade | ||
+ | sudo apt-get install python3-rpi.gpio python3-pip</ | ||
+ | - Type the following command and press enter to install the Adafruit-pca9685 library\\ \\ < | ||
+ | - Type the following commands and press enter after each line to create a directory for the PiBot code\\ \\ < | ||
+ | cd ~/ | ||
+ | - Type the following command and press enter to download the Python code for this lesson\\ \\ < | ||
+ | - Place the PiBot on the floor in an area that is free of any obstacles | ||
+ | - Type the following command and press enter to make the PiBot move\\ \\ < | ||
+ | - Type the following command and press enter to close the SSH connection\\ \\ < | ||
+ | |||
+ | ===== Software Explanation ===== | ||
+ | |||
+ | - To view the code that makes the PiBot run perform the following steps | ||
+ | - Open the Visual Studio Code from the Applications directory on the flash drive | ||
+ | - Click on the small green square in the bottom left corner of the screen\\ \\ <WRAP box>{{ : | ||
+ | - Select the " | ||
+ | - Type " | ||
+ | - Click the icon that looks like two pieces of paper in the upper left of the window and click the "Open Folder" | ||
+ | - Select the " | ||
+ | - Select the picar-basic.py file in the list on the left\\ \\ <WRAP box>{{ : | ||
+ | - Find line 20 in the picar-basic.py file. What is the name of the variable? What value is assigned to the variable? What do you think this value controls on the PiBot?\\ \\ <WRAP round tip>The line numbers are displayed to the left of each line of text and are a feature of the Visual Studio Code editor</ | ||
+ | - Find the other places in the code where this variable is used. How many of them are there?\\ \\ <WRAP round tip>When you see some text followed by a ' | ||
+ | - Find the definition of the function that uses the variable. What does the function do?\\ \\ <WRAP round tip>In the definition of the function, the text between the ' | ||
+ | - How would you change the code to make the PiBot move faster? How about to make it move slower? Make one of those changes to the code and save it using File-> | ||
+ | - Open a terminal in Visual Studio Code from the Terminal-> | ||
+ | - Type the following command and press enter to make the PiBot move with your changes\\ \\ < | ||
+ | - Try out the other change to the code following the same steps | ||
+ | - When you're finished testing out your changes type the following command in the terminal and press enter to shutdown the PiBot\\ \\ < | ||
+ | - Click on the small green rectangle in the bottom left corner of the screen and select "Close Remote Connection" | ||
+ | - Wait 3-5 minutes for the green light on the Raspberry Pi to stop flashing and turn off the switch on the PiBot battery | ||
+ | |||
+ | [[: |