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.
[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