View All Posts
read
Want to keep up to date with the latest posts and videos? Subscribe to the newsletter
HELP SUPPORT MY WORK: If you're feeling flush then please stop by Patreon Or you can make a one off donation via ko-fi

Discover WokWi, an online Arduino and ESP32 simulator with incredible functionality! Test your firmware, run Python code, and simulate various components in this powerful web-based tool.

Related Content
Transcript

[0:00] Hey everyone I just stumbled across WokWi it’s an online Arduino and ESP32 simulator.
[0:06] They’ve got a bunch of examples on their home page but let’s try some esp32

[0:11] right after this quick word from the channel sponsor PCBWay.
[0:14] Do you like PCBs?
[0:16] Do you want to make a PCB and a weird and wacky colour like purple?
[0:19] Maybe you’d like a flexible PCB?
[0:21] Or maybe you’d like someone to do some CNC work for you?
[0:25] Check out the link to PCBWay in the description
[0:30] So let’s create an ESP32 sketch.
[0:33] We’ll do the classic blink sketch.
[0:34] So the first thing we’ll need is an LED.
[0:37] We’ll wire this up with the anode connected to a GPIO pin and the cathode connected to ground.
[0:44] Now in the code, we just need to set the pin to output.
[0:54] And then in our loop we’ll set it to high have a half-second delay and

[0:58] then set it to low and then follow that with another half-second delay
[1:10] And now we can just hit the simulate button and it will start to flash our LED.
[1:14] It works amazingly well
[1:20] So that’s a simple blink sketch.
[1:22] You can also pull in Arduino libraries.
[1:24] Here we have a TinyPICO board and we’re pulling in the TinyPICO helper library.
[1:29] We’re going to cycle the colours on the dot star LED.
[1:32] So here’s all the code and then we just hit simulate
[1:38] It works! It works really nicely.
[1:40] We’re now running a TinyPICO and running the dot star led.
[1:45] There are also more complex examples.
[1:48] So here’s a seven-segment display so we’re using the SevSeg library and then we hit simulate

[1:55] and it updates the seven-segment display
[2:05] There’s also built-in support for wi-fi so here’s a sketch that will scan for wi-fi networks
[2:13] and it will print out all the details about the wi-fi network it’s found.
[2:17] So, there’s a built-in network in the simulation system so if we run this sketch it will startup
[2:37] and now we’ve initialized the wi-fi and we’re scanning
[2:43] and it’s found the guest network on the WokWi.
[2:46] So you can connect to this and use the internet from your ESP32.
[2:50] Not only that you can also do this in Python.
[2:53] So here’s the same code but running in Python so if we run this
[2:59] We’ll see it starts the python interactive environment and it’s run and it scan the networks.
[3:05] I can even run bits of Python code here so we can print “hello world”
[3:16] So here are some more Python examples this is running a neopixel example.
[3:21] So we import the neopixel and then when we run it. It cycles through the neopixel colors.
[3:36] There’s also quite an interesting thing you can do.
[3:39] So here I’m running in PlatformIO and I’m building the blink sketch and compiling it on my computer.
[3:45] So I’ll compile the firmware.
[3:49] And now if we go back to WokWi I can hit “F1”

[3:53] and I can load in my firmware and run it on the simulator.
[3:58] So we select our bin file and now our blink sketch is running.
[4:03] And you can see it’s running my code because we can see the serialwrite

[4:06] writing “Blink” which is what I have in my code.
[4:09] So that’s pretty amazing.
[4:10] We built the firmware on my machine and now we’re running it on the simulator.
[4:15] Now of course there are some limitations.
[4:17] We don’t have I2S, SPI, PWM, DMA or Bluetooth.
[4:22] There’s no hardware acceleration.
[4:24] But apart from that,

[4:25] it works amazingly well and it seems like a really good way of testing your firmware.
[4:30] So if you’ve used this before please let me know

[4:32] in the comments what your experience was and how well it worked for you.
[4:35] I’d never seen it before so I was quite surprised to come across it.
[4:38] If you’d known about it for a while then why didn’t you tell me?
[4:41] Because I’d loved to have heard about it.
[4:43] Thanks for watching and I’ll see you next time


HELP SUPPORT MY WORK: If you're feeling flush then please stop by Patreon Or you can make a one off donation via ko-fi
Want to keep up to date with the latest posts and videos? Subscribe to the newsletter
Blog Logo

Chris Greening

> Image

atomic14

A collection of slightly mad projects, instructive/educational videos, and generally interesting stuff. Building projects around the Arduino and ESP32 platforms - we'll be exploring AI, Computer Vision, Audio, 3D Printing - it may get a bit eclectic...

View All Posts