This article will show you how to use the Wokwi Embedded Systems simulator. Using the online simulator saves time in constantly switching between hardware and software. No hardware is necessary. You don't need to make any payments or log in.
Features implemented as on December 2022
STEP 1:
Open the Home page
Visit the Wokwi home page website by clicking the link to the Embedded systems simulator
STEP 2:
Click on the SDK option
Select the Raspberry Pi Pico Simulator SDK option by clicking on more options.
STEP 3:
Template example
You will see the empty example template with the Pi Pico component already added into the example library.
STEP 4:
Embedded System Simulator
You will see a few pointers about the embedded systems simulator window.
STEP 5:
Adding code in the editor window
Let us add an example of LED blinking. There is an onboard LED present on the Raspberry Pi Pico. We will blink the LED at a given constant interval in milliseconds. Here is the code used to blink the built-in LED.
/**
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include "pico/stdlib.h"
void setup() {
#ifndef PICO_DEFAULT_LED_PIN
#warning blink example requires a board with a regular LED
#else
const uint LED_PIN = PICO_DEFAULT_LED_PIN;
gpio_init(LED_PIN);
gpio_set_dir(LED_PIN, GPIO_OUT);
while (true) {
gpio_put(LED_PIN, 1);
sleep_ms(250);
gpio_put(LED_PIN, 0);
sleep_ms(250);
}
#endif
}
void loop() {}
STEP 6:
Editor window on Wokwi Systems Simulator
To let the code compile, click on the simulation window. if there are no errors, the simulation will start running. if there are some errors. Here is the screenshot of the editor window (with an intentional error made in the code).
This example will show the error line number as well as a hint for the user to solve the error.
STEP 6:
Fix the error and run the simulation
STEP 7:
Simulation in action
Project Link: https://wokwi.com/projects/298013072042230285
Summary/Suggestion:
In this example, a Wokwi embedded systems simulator is used to write a C program on Raspberry Pi Pico SDK. The simulator is being used by people worldwide to teach and learn embedded programming.
Raspberry Pi Pico Examples on Wokwi:
Here are the simulator example projects built using Wokwi simulator.
- Pi Pico and LCD1602
- Pi Pico Traffic Light
- Pi Pico C++ SDK Blink
- Pi Pico C++ SDK 7-Segment Example
- Pi Pico Stepper Motor Example
For feedback and support, hop on to Wokwi group now.
Discord - https://wokwi.com/discord
Facebook - https://www.facebook.com/groups/wokwi
Comments
Please log in or sign up to comment.