diff --git a/images/sonar_noise.png b/images/sonar_noise.png new file mode 100644 index 0000000..73d5cc5 Binary files /dev/null and b/images/sonar_noise.png differ diff --git a/images/sonar_noise_averaged.png b/images/sonar_noise_averaged.png new file mode 100644 index 0000000..63b0d2c Binary files /dev/null and b/images/sonar_noise_averaged.png differ diff --git a/images/sonar_noise_median.png b/images/sonar_noise_median.png new file mode 100644 index 0000000..2f66da2 Binary files /dev/null and b/images/sonar_noise_median.png differ diff --git a/index.html b/index.html index 357040b..637963b 100644 --- a/index.html +++ b/index.html @@ -28,6 +28,7 @@ + @@ -48,13 +49,16 @@

Step 1: Setting up the IDE

-

There are many IDEs that we can use to program MicroPython robot, we'll be using one called "Thonny". So let's begin by downloading it.

+

There are many IDEs that we can use to program MicroPython robot, we'll be using one called + "Thonny". So let's begin by downloading it.

Download

You can also get it from the Thonny website, https://thonny.org/

@@ -69,13 +73,16 @@
  1. In Thonny, click on the Run->Configure Interpreter buttons at the top of the window.
  2. Choose "MicroPython (Raspberry Pi Pico) from the first dropdown menu.
  3. -
  4. Click the "Install or update MicroPython" button down the bottom-right of the window.
  5. -
  6. You need to put your device in FLASH mode, hold down the BOOT button, press and release the RESET button.
  7. +
  8. Click the "Install or update MicroPython" button down the bottom-right of the window. +
  9. +
  10. You need to put your device in FLASH mode, hold down the BOOT button, press and release the + RESET button.
  11. You should now find a drive called "RPI-RP2". in the Target volume dropdown, shoose it.
  12. Choose the variant "Raspberry Pi Pico - Pico / Pico H"
  13. Press Install button to install the firmware.
  14. Reset the device again with the RESET button.
  15. -
  16. Press the cancel button to close the firmware update panel, then press OK to officially begin coding.
  17. +
  18. Press the cancel button to close the firmware update panel, then press OK to officially + begin coding.
@@ -100,8 +107,10 @@

Step 1: Open/Create the main.py file

-

When your device is plugged into your computer, you should be able to press the File->Load button, and choose "Raspberry Pi Pico" to load from.

-

If no such file exists we need to make it, press File->New, and then save it to the Raspberry Pi Pico as "main.py"

+

When your device is plugged into your computer, you should be able to press the File->Load + button, and choose "Raspberry Pi Pico" to load from.

+

If no such file exists we need to make it, press File->New, and then save it to the Raspberry Pi + Pico as "main.py"

@@ -110,7 +119,8 @@

Step 2: Open the Serial Monitor

-

To get messages back from your device, and to read errors, press the view->shellbutton and make sure +

To get messages back from your device, and to read errors, press the view->shellbutton and make + sure you have the shell window open at the bottom.


@@ -119,7 +129,8 @@ print("Hello World") and then save, yuou should see the message appear in the Serial monitor.

-

Note that the code won't persist on the robot after a reset unless you also SAVE it to the device, RUN just runs it once

+

Note that the code won't persist on the robot after a reset unless you also SAVE it to the + device, RUN just runs it once


Step 4: Code all the things!

@@ -132,7 +143,7 @@ Robot turning right
- +
@@ -908,10 +919,13 @@ while True:

Step 2: Coding

-

We'll use a library to handle sending and listening for the pulses. Put this module on your device.

+

We'll use a library to handle sending and listening for the pulses. Put this module on your + device.


-

When the "distance()" function is called, it sends a short pulse on the trigger pin, then waits for a response on the echo pin. The time it takes for the echo to return is used to calculate the distance.

- +

When the "distance()" function is called, it sends a short pulse on the trigger pin, then waits + for a response on the echo pin. The time it takes for the echo to return is used to calculate + the distance.

+

@@ -955,7 +969,8 @@ class Sonar:
                 
                 

Step 3: Call it in the main.py

-

Now all we need to do is create the object and call the distance function in the main.py file.

+

Now all we need to do is create the object and call the distance function in the main.py file. +


@@ -1076,6 +1091,237 @@ while True:
         
 
 
+
+
+
+
+
+
+
+
+
+        
+        
+
+
+        
+        
+
+