MicroController Web-Server: Getting Started
Getting The Code Onto Your Devise
Step 1
Before we begin, head over to our GitHub repository (link in the description) and copy the repository link which you can find when clicking the the green code button.
This repository contains all the code for our WebServer.
Step 2
-
Ensure your microcontroller is powered and connected to your computer with the latest MicroPython firmware installed.
-
Open a terminal or command prompt and navigate to the directory where you want to store the MicroPython files. Use the
cd
command to change directories.
Step 3
To download the necessary files, clone the GitHub repository using the following command:
''' bash git clone https://github.com/gurgleapps/pico-web-server-control.git '''
- the link is the link you copied from the GitHub repository
This will create a local copy of the repository on your computer.
Step 4
-
Open your code editor or IDE (Integrated Development Environment), such as Thonny or Mu.
-
Open the folder you just downloaded from the GitHub repository.
Step 5
Upload all the files and folders from the downloaded repository to your microcontroller.
Setting Up
Configure Wi-Fi Settings
Locate and open the config.py
file on your microcontroller. This file may have a different name or location based on your MicroPython version, but its purpose remains the same.
Within the file, locate the placeholders for Wi-Fi SSID and password.
Replace your_wifi_ssid
with your Wi-Fi network's name (SSID) and your_wifi_password
with your Wi-Fi password.
This step is crucial for your microcontroller to connect to the internet.
In the same config.py
file, you may find options that control the onboard LED behavior.
Enabling these options allows the microcontroller to blink its IP address. We don't need to enable these options as the ip address will be shown in repel.
Run the Main Script
Open the main.py
file in your code editor and run the script. You should see the message "Waiting for connection..." followed by your microcontroller's IP address in the output.
Access Your Microcontroller
Open your web browser and type http://
followed by the IP address displayed in the script's output. This should lead you to the microcontroller's web interface.