[{"data":1,"prerenderedAt":167},["ShallowReactive",2],{"post-\u002Fblog\u002F2020\u002Fesp32-evb-and-platform-io-yet-another-esp32-tutorial":3},{"id":4,"title":5,"body":6,"categories":149,"date":152,"description":45,"extension":153,"image":154,"meta":155,"navigation":162,"path":163,"seo":164,"stem":165,"__hash__":166},"blog\u002Fblog\u002F2020\u002Fesp32-evb-and-platform-io-yet-another-esp32-tutorial.md","ESP32-EVB, PlatformIO And Arduino - Yet Another ESP32 tutorial",{"type":7,"value":8,"toc":143},"minimark",[9,13,24,27,32,35,46,49,55,58,61,66,70,73,76,82,85,90,93,99,102,107,110,115,118,121,124,128],[10,11,12],"p",{},"What the heck? Aren't there enough toturials out there about ESP32? I believe: Yes, too many. And there are too many that struggle with setting up the arduino environment for non-arduino hardware. But there is a straight-forward solution that works out of the box: platform.io or also known as PIO.",[10,14,15,16,23],{},"And there are enought tutorials about ",[17,18,22],"a",{"href":19,"rel":20},"https:\u002F\u002Fplatformio.org\u002Finstall\u002Fide?install=vscode",[21],"nofollow","installing platform.io",". It is as easy as you can think. Install Visual Studio Code from Microsoft and install the PIO plugin in VSCode.",[10,25,26],{},"Then create a new project VSCode -> New Project and select Olimex ESP32-EVB with Arduino Platform. After PIO downloaded all dependencies and configured your project, we are ready to go!",[28,29,31],"h2",{"id":30},"hello-world-relay-toggle","Hello World - Relay Toggle",[10,33,34],{},"Open main.cpp and edit it, so it will look like that:",[36,37,42],"pre",{"className":38,"code":40,"language":41},[39],"language-text","#include \u003CArduino.h>\n\nconst int relay1pin = 32;\n\nvoid setup() {\n  pinMode(relay1pin, OUTPUT);\n}\n\nvoid loop() {\n  digitalWrite(relay1pin, HIGH);\n  delay(10000);\n  digitalWrite(relay1pin, LOW);\n  delay(10000);\n}\n","text",[43,44,40],"code",{"__ignoreMap":45},"",[10,47,48],{},"...connect your Olimex ESP32-EVB and hit the upload button:",[10,50,51],{},[52,53],"img",{"alt":45,"src":54},"\u002Fimages\u002Fblog\u002F2020\u002F06\u002Fimage.png",[10,56,57],{},"Done! Your Relay should toogle every 10 seconds.",[10,59,60],{},"The pin numbers are simply the GPIO numbers you can find in the schematics of your board, in this case, it is 32.",[10,62,63],{},[52,64],{"alt":45,"src":65},"\u002Fimages\u002Fblog\u002F2020\u002F06\u002Fimage-1.png",[28,67,69],{"id":68},"printf-debugging","printf-Debugging",[10,71,72],{},"Despite the fact, that printf debugging is somewhat frowned upon, it is a very practical first step. And with platform.io and evaluation boards like this one, it is as easy as pressing a button. No additional wiring, no hassle with pins, ports or blown up code.",[10,74,75],{},"Extend your code to look like this:",[36,77,80],{"className":78,"code":79,"language":41},[39],"#include \u003CArduino.h>\n\nconst int relay1pin = 32;\n\nvoid setup() {\n  Serial.begin(115200);\n  pinMode(relay1pin, OUTPUT);\n}\n\nvoid loop() {\n  Serial.printf(\"Switch on\\r\\n\");\n  digitalWrite(relay1pin, HIGH);\n  delay(10000);\n  Serial.printf(\"Switch off\\r\\n\");\n  digitalWrite(relay1pin, LOW);\n  delay(10000);\n}\n",[43,81,79],{"__ignoreMap":45},[10,83,84],{},"Add two lines to your platfromio.ini file. You will find the correct COM port in terminal when uploading the new code to your device.",[10,86,87],{},[52,88],{"alt":45,"src":89},"\u002Fimages\u002Fblog\u002F2020\u002F06\u002Fimage-3.png",[10,91,92],{},"In my case it is COM6 and platformio.ini looks like this:",[36,94,97],{"className":95,"code":96,"language":41},[39],"platform = espressif32\nboard = esp32-evb\nframework = arduino\nmonitor_port = COM6\nmonitor_speed = 115200\n",[43,98,96],{"__ignoreMap":45},[10,100,101],{},"Upload your code again after changing the ini file. If it does not print your output automatically to your terminal, start the monitor manually:",[10,103,104],{},[52,105],{"alt":45,"src":106},"\u002Fimages\u002Fblog\u002F2020\u002F06\u002Fimage-2.png",[10,108,109],{},"From now on, you should see the printf output in your terminal every time you upload your code again:",[10,111,112],{},[52,113],{"alt":45,"src":114},"\u002Fimages\u002Fblog\u002F2020\u002F06\u002Fimage-4.png",[10,116,117],{},"OK, that's all. There are many tutorials out there, how to setup a webserver, controlling pins, using SPI or whatever. But now, you have some great arduino IDE without arduino IDE :-P",[10,119,120],{},"Have fun coding!",[122,123],"hr",{},[28,125,127],{"id":126},"kommentare-comments","Kommentare \u002F Comments",[10,129,130,131,136,137,142],{},"Hast du Fragen oder Anmerkungen zu diesem Artikel? ",[17,132,135],{"href":133,"rel":134},"https:\u002F\u002Fgithub.com\u002Fthe78mole-blog\u002Fthe78mole-blog.github.io\u002Fissues\u002Fnew?title=Kommentar+zu%3A+esp32-evb-and-platform-io-yet-another-esp32-tutorial&labels=comment",[21],"Erstelle ein GitHub Issue"," oder starte eine ",[17,138,141],{"href":139,"rel":140},"https:\u002F\u002Fgithub.com\u002Fthe78mole-blog\u002Fthe78mole-blog.github.io\u002Fdiscussions",[21],"Diskussion",".",{"title":45,"searchDepth":144,"depth":144,"links":145},2,[146,147,148],{"id":30,"depth":144,"text":31},{"id":68,"depth":144,"text":69},{"id":126,"depth":144,"text":127},[150,151],"ESP32","Uncategorized","2020-06-02","md","\u002Fimages\u002Fblog\u002F2020\u002F06\u002FESP32-EVB.jpg",{"tags":156},[157,150,158,159,160,161],"arduino","ESP32-EVB","Olimex","pio","platform.io",true,"\u002Fblog\u002F2020\u002Fesp32-evb-and-platform-io-yet-another-esp32-tutorial",{"title":5,"description":45},"blog\u002F2020\u002Fesp32-evb-and-platform-io-yet-another-esp32-tutorial","TO_2jC8UKZhHf_EFQv2ixgFfVn-pT8We2dfMQG9jJxk",1777286694222]