SlideShare a Scribd company logo
1 of 49
@jenschr
Getting started
with PlatformIO
Download and install VS Code
Visual Studio Code
as a code editor
Download and set up PlatformIO
Click Extension Manager icon on the left toolbar
1. Open Extension
Manager
2. Search for
“PlatformIO”
3. Install the
PlatformIO IDE
1.
2.
3.
Lets get started
1.
2.
3.
1. Click the PlatformIO icon
2. Click the “Open” item to open the
start page
3. Click the “New Project” button
Configure your project
Select your microcontroller in the Boards menu
Select Arduino UNO, ESP32 or any
other microcontroller you have
brought with you.
Make sure to select the exact variant
if there are multiple versions (such
as for ESP32 based boards)
Trust
yourself!
Hello world!
edit the file src/main.cpp
Hello World
2.
1.
1. Click the Explorer icon to show
the files generated
2. Double-click the pre-defined
source file to open it in the editor
This is how you’ll start every project
created with the Arduino framework.
Start typing!
Does it compile?
1.
1. Click the PlatformIO icon to
show the commands
2. Click the Build option to compile
the code
If there are no errors, you typed it all
correctly. If you get an error - read it
carefully and raise your hand if you
don’t understand how to fix it
There are many shortcuts for the
command:
- Control-Option-B / Ctrl-Alt-B
- Control-P, PlatformIO: Build
2.
Does it compile?
Does it compile?
Uploading
To the board
1.
1. Click the PlatformIO icon to
show the commands
2. Click the Upload option to
compile the code
A terminal windows should open and
lots of text should scroll by -
hopefully with a [SUCCESS]
message at the end.
There are many shortcuts for the
command:
- Control-Option-U / Ctrl-Alt-U
- Control-P, PlatformIO: Upload
2.
• Click the PlatformIO icon to show the
commands
• Click the Monitor option to open a
terminal window that shows the
“Hello world” text from the
microcontroller
• It will print out the text once every
second - or rather every 1000
milliseconds.
• Microcontrollers are very precise, so
you could even ask it to wait a
microsecond, but that would produce
a massive stream of “Hello world”
messages.
Did it work?
see it talk back to us
1.
2.
Workflow
• Create a Project
• Either in a New > Window, or in the same window
• Setup the project for your development board
• Adjust platformio.ini (if required)
• Write code
• Upload to test
• Use monitor to see the debug output
Hello blinky!
Hello World for hardware should always blink a LED!
Let’s make it proper
Using libraries
with your micro
1. Click the PlatformIO icon
2. Click the “Libraries” item to
open the library search page
3. Type “Adafruit Dotstar” in the
search field and press enter
Using libraries
1.
2.
3.
(as an example)
Once you find the correct library
("Adafruit Dotstar”), click to view
the details and examples.
Use the dropdown under
Examples to change it to
“ItsyBitsyM4Onboard”.
Copy the example code (to
memory) and then click the Add
to Project button.
Adding Dotstars
to the project
In the popup - select the Hello World
project and click Add
Adding Dotstars
What happened?
What happened under the hood is that
this text file was updated.
platformio.ini is the main setup of your
project, so let’s take a look at it?
Adding Dotstars
Paste in the “ItsyBitsyM4Onboard” example
what’s wrong?
When we build the library, we get an
error telling that Wire.h is missing.
This is a library that is used by the
Adafruit Dotstar library.
This is a bug in the example we’re
using. The library is already on our
machine, but we need to include it.
Can anyone suggest how we fix
this?
Errors?
added to the top
In this case, it was one of the
common libraries that were
needed.
wire.h
what’s wrong?
The error says that 'rainbow' was
not declared in this scope. But we
do have a method called
“rainbow”, don’t we?
The problem is that this method is
being used BEFORE the compiler
has reached the part of the code
it’s in.
Let’s move our loop-method to
the bottom of the file to solve this.
More errors?
Source Control
github.com
If you don’t have GIT installed on your machine, you’ll see a download button
Click to install GIT
https://code.visualstudio.com/shortcuts/keyboard-shortcuts-macos.pdf

More Related Content

Similar to Getting started with PlatformIO

ABC Consolidated Financial InfoABC Companys current financial inf.docx
ABC Consolidated Financial InfoABC Companys current financial inf.docxABC Consolidated Financial InfoABC Companys current financial inf.docx
ABC Consolidated Financial InfoABC Companys current financial inf.docxransayo
 
Hacking the Kinect with GAFFTA Day 1
Hacking the Kinect with GAFFTA Day 1Hacking the Kinect with GAFFTA Day 1
Hacking the Kinect with GAFFTA Day 1benDesigning
 
Prg 218 entire course
Prg 218 entire coursePrg 218 entire course
Prg 218 entire coursegrades4u
 
Visual c++ 2010_tutorial
Visual c++ 2010_tutorialVisual c++ 2010_tutorial
Visual c++ 2010_tutorialAyub Abd Rahman
 
Csharp Hands On Lab Paul Yao
Csharp Hands On Lab Paul YaoCsharp Hands On Lab Paul Yao
Csharp Hands On Lab Paul YaoMamgmo Magnda
 
Debugging programs with Keil uVision
Debugging programs with Keil uVisionDebugging programs with Keil uVision
Debugging programs with Keil uVisionSaravananVijayakumar4
 
Open frameworks 101_fitc
Open frameworks 101_fitcOpen frameworks 101_fitc
Open frameworks 101_fitcbenDesigning
 
Membangun Desktop App
Membangun Desktop AppMembangun Desktop App
Membangun Desktop AppFajar Baskoro
 
Getting started with code composer studio v3.3 for tms320 f2812
Getting started with code composer studio v3.3 for tms320 f2812Getting started with code composer studio v3.3 for tms320 f2812
Getting started with code composer studio v3.3 for tms320 f2812Pantech ProLabs India Pvt Ltd
 
Live Source - an Agile Toolkit
Live Source - an Agile ToolkitLive Source - an Agile Toolkit
Live Source - an Agile ToolkitAlline Oliveira
 
Introduction of VS2012 IDE and ASP.NET Controls
Introduction of VS2012 IDE and ASP.NET ControlsIntroduction of VS2012 IDE and ASP.NET Controls
Introduction of VS2012 IDE and ASP.NET ControlsKhademulBasher
 
CC-Castle; The best Real-Time/Embedded/HighTech language EVER?
CC-Castle; The best Real-Time/Embedded/HighTech language EVER?CC-Castle; The best Real-Time/Embedded/HighTech language EVER?
CC-Castle; The best Real-Time/Embedded/HighTech language EVER?Albert Mietus
 
Module Six Assignment Guidelines and Rubric.htmlOverviewMa.docx
Module Six Assignment Guidelines and Rubric.htmlOverviewMa.docxModule Six Assignment Guidelines and Rubric.htmlOverviewMa.docx
Module Six Assignment Guidelines and Rubric.htmlOverviewMa.docxroushhsiu
 

Similar to Getting started with PlatformIO (20)

web application.pptx
web application.pptxweb application.pptx
web application.pptx
 
ABC Consolidated Financial InfoABC Companys current financial inf.docx
ABC Consolidated Financial InfoABC Companys current financial inf.docxABC Consolidated Financial InfoABC Companys current financial inf.docx
ABC Consolidated Financial InfoABC Companys current financial inf.docx
 
Hacking the Kinect with GAFFTA Day 1
Hacking the Kinect with GAFFTA Day 1Hacking the Kinect with GAFFTA Day 1
Hacking the Kinect with GAFFTA Day 1
 
CI & CD- mobile application
CI & CD- mobile applicationCI & CD- mobile application
CI & CD- mobile application
 
CI & CD- mobile application
CI & CD- mobile applicationCI & CD- mobile application
CI & CD- mobile application
 
Prg 218 entire course
Prg 218 entire coursePrg 218 entire course
Prg 218 entire course
 
Visual c++ 2010_tutorial
Visual c++ 2010_tutorialVisual c++ 2010_tutorial
Visual c++ 2010_tutorial
 
Csharp Hands On Lab Paul Yao
Csharp Hands On Lab Paul YaoCsharp Hands On Lab Paul Yao
Csharp Hands On Lab Paul Yao
 
Debugging programs with Keil uVision
Debugging programs with Keil uVisionDebugging programs with Keil uVision
Debugging programs with Keil uVision
 
Open frameworks 101_fitc
Open frameworks 101_fitcOpen frameworks 101_fitc
Open frameworks 101_fitc
 
Membangun Desktop App
Membangun Desktop AppMembangun Desktop App
Membangun Desktop App
 
Ecad final
Ecad finalEcad final
Ecad final
 
Getting started with code composer studio v3.3 for tms320 f2812
Getting started with code composer studio v3.3 for tms320 f2812Getting started with code composer studio v3.3 for tms320 f2812
Getting started with code composer studio v3.3 for tms320 f2812
 
Live Source - an Agile Toolkit
Live Source - an Agile ToolkitLive Source - an Agile Toolkit
Live Source - an Agile Toolkit
 
Introduction of VS2012 IDE and ASP.NET Controls
Introduction of VS2012 IDE and ASP.NET ControlsIntroduction of VS2012 IDE and ASP.NET Controls
Introduction of VS2012 IDE and ASP.NET Controls
 
Visual c++ demo
Visual c++ demoVisual c++ demo
Visual c++ demo
 
ID E's features
ID E's featuresID E's features
ID E's features
 
CC-Castle; The best Real-Time/Embedded/HighTech language EVER?
CC-Castle; The best Real-Time/Embedded/HighTech language EVER?CC-Castle; The best Real-Time/Embedded/HighTech language EVER?
CC-Castle; The best Real-Time/Embedded/HighTech language EVER?
 
Module Six Assignment Guidelines and Rubric.htmlOverviewMa.docx
Module Six Assignment Guidelines and Rubric.htmlOverviewMa.docxModule Six Assignment Guidelines and Rubric.htmlOverviewMa.docx
Module Six Assignment Guidelines and Rubric.htmlOverviewMa.docx
 
Ios - Intorduction to view controller
Ios - Intorduction to view controllerIos - Intorduction to view controller
Ios - Intorduction to view controller
 

More from Jens Brynildsen

Kunstig intelligens - Hvordan det påvirker oss allerede og fremover
Kunstig intelligens - Hvordan det påvirker oss allerede og fremoverKunstig intelligens - Hvordan det påvirker oss allerede og fremover
Kunstig intelligens - Hvordan det påvirker oss allerede og fremoverJens Brynildsen
 
Avansert laserkurs på bitraf
Avansert laserkurs på bitrafAvansert laserkurs på bitraf
Avansert laserkurs på bitrafJens Brynildsen
 
Elektronikk Workshop, Dag 2 (montering og testing)
Elektronikk Workshop, Dag 2 (montering og testing)Elektronikk Workshop, Dag 2 (montering og testing)
Elektronikk Workshop, Dag 2 (montering og testing)Jens Brynildsen
 
Bitraf vedlikeholds workshop
Bitraf vedlikeholds workshopBitraf vedlikeholds workshop
Bitraf vedlikeholds workshopJens Brynildsen
 
Two day Electronics workshop with KiCad training
Two day Electronics workshop with KiCad trainingTwo day Electronics workshop with KiCad training
Two day Electronics workshop with KiCad trainingJens Brynildsen
 
Loddekurs på Bitraf 2021
Loddekurs på Bitraf 2021Loddekurs på Bitraf 2021
Loddekurs på Bitraf 2021Jens Brynildsen
 
Arduino Motor control workshop
Arduino Motor control workshopArduino Motor control workshop
Arduino Motor control workshopJens Brynildsen
 
Arduino workshop @ Bitraf 17. Nov 2021
Arduino workshop @ Bitraf 17. Nov 2021Arduino workshop @ Bitraf 17. Nov 2021
Arduino workshop @ Bitraf 17. Nov 2021Jens Brynildsen
 
Bitraf maintenance workshop
Bitraf maintenance workshopBitraf maintenance workshop
Bitraf maintenance workshopJens Brynildsen
 
Bitraf smd workshop (Norwegian)
Bitraf smd workshop (Norwegian)Bitraf smd workshop (Norwegian)
Bitraf smd workshop (Norwegian)Jens Brynildsen
 

More from Jens Brynildsen (20)

VinylKutter Workshop
VinylKutter WorkshopVinylKutter Workshop
VinylKutter Workshop
 
Soft Circuits
Soft CircuitsSoft Circuits
Soft Circuits
 
Bitraf Vedlikehold
Bitraf VedlikeholdBitraf Vedlikehold
Bitraf Vedlikehold
 
Vinyl Cutting workshop
Vinyl Cutting workshopVinyl Cutting workshop
Vinyl Cutting workshop
 
KiCad 7 Workshop
KiCad 7 WorkshopKiCad 7 Workshop
KiCad 7 Workshop
 
Kunstig intelligens - Hvordan det påvirker oss allerede og fremover
Kunstig intelligens - Hvordan det påvirker oss allerede og fremoverKunstig intelligens - Hvordan det påvirker oss allerede og fremover
Kunstig intelligens - Hvordan det påvirker oss allerede og fremover
 
Bitraf Arduino Workshop
Bitraf Arduino WorkshopBitraf Arduino Workshop
Bitraf Arduino Workshop
 
KiCad Workshop
KiCad WorkshopKiCad Workshop
KiCad Workshop
 
Bitraf Vedlikehold
Bitraf VedlikeholdBitraf Vedlikehold
Bitraf Vedlikehold
 
Kurs i LaserKurs
Kurs i LaserKursKurs i LaserKurs
Kurs i LaserKurs
 
Avansert laserkurs på bitraf
Avansert laserkurs på bitrafAvansert laserkurs på bitraf
Avansert laserkurs på bitraf
 
Elektronikk Workshop, Dag 2 (montering og testing)
Elektronikk Workshop, Dag 2 (montering og testing)Elektronikk Workshop, Dag 2 (montering og testing)
Elektronikk Workshop, Dag 2 (montering og testing)
 
Bitraf vedlikeholds workshop
Bitraf vedlikeholds workshopBitraf vedlikeholds workshop
Bitraf vedlikeholds workshop
 
Two day Electronics workshop with KiCad training
Two day Electronics workshop with KiCad trainingTwo day Electronics workshop with KiCad training
Two day Electronics workshop with KiCad training
 
How to use a Multimeter
How to use a MultimeterHow to use a Multimeter
How to use a Multimeter
 
Loddekurs på Bitraf 2021
Loddekurs på Bitraf 2021Loddekurs på Bitraf 2021
Loddekurs på Bitraf 2021
 
Arduino Motor control workshop
Arduino Motor control workshopArduino Motor control workshop
Arduino Motor control workshop
 
Arduino workshop @ Bitraf 17. Nov 2021
Arduino workshop @ Bitraf 17. Nov 2021Arduino workshop @ Bitraf 17. Nov 2021
Arduino workshop @ Bitraf 17. Nov 2021
 
Bitraf maintenance workshop
Bitraf maintenance workshopBitraf maintenance workshop
Bitraf maintenance workshop
 
Bitraf smd workshop (Norwegian)
Bitraf smd workshop (Norwegian)Bitraf smd workshop (Norwegian)
Bitraf smd workshop (Norwegian)
 

Recently uploaded

Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 

Recently uploaded (20)

Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 

Getting started with PlatformIO

  • 3. Visual Studio Code as a code editor
  • 4. Download and set up PlatformIO Click Extension Manager icon on the left toolbar 1. Open Extension Manager 2. Search for “PlatformIO” 3. Install the PlatformIO IDE 1. 2. 3.
  • 5.
  • 6. Lets get started 1. 2. 3. 1. Click the PlatformIO icon 2. Click the “Open” item to open the start page 3. Click the “New Project” button
  • 7. Configure your project Select your microcontroller in the Boards menu Select Arduino UNO, ESP32 or any other microcontroller you have brought with you. Make sure to select the exact variant if there are multiple versions (such as for ESP32 based boards)
  • 10. edit the file src/main.cpp Hello World 2. 1. 1. Click the Explorer icon to show the files generated 2. Double-click the pre-defined source file to open it in the editor This is how you’ll start every project created with the Arduino framework.
  • 12. Does it compile? 1. 1. Click the PlatformIO icon to show the commands 2. Click the Build option to compile the code If there are no errors, you typed it all correctly. If you get an error - read it carefully and raise your hand if you don’t understand how to fix it There are many shortcuts for the command: - Control-Option-B / Ctrl-Alt-B - Control-P, PlatformIO: Build 2.
  • 15. Uploading To the board 1. 1. Click the PlatformIO icon to show the commands 2. Click the Upload option to compile the code A terminal windows should open and lots of text should scroll by - hopefully with a [SUCCESS] message at the end. There are many shortcuts for the command: - Control-Option-U / Ctrl-Alt-U - Control-P, PlatformIO: Upload 2.
  • 16. • Click the PlatformIO icon to show the commands • Click the Monitor option to open a terminal window that shows the “Hello world” text from the microcontroller • It will print out the text once every second - or rather every 1000 milliseconds. • Microcontrollers are very precise, so you could even ask it to wait a microsecond, but that would produce a massive stream of “Hello world” messages. Did it work? see it talk back to us 1. 2.
  • 17. Workflow • Create a Project • Either in a New > Window, or in the same window • Setup the project for your development board • Adjust platformio.ini (if required) • Write code • Upload to test • Use monitor to see the debug output
  • 19. Hello World for hardware should always blink a LED! Let’s make it proper
  • 21. with your micro 1. Click the PlatformIO icon 2. Click the “Libraries” item to open the library search page 3. Type “Adafruit Dotstar” in the search field and press enter Using libraries 1. 2. 3.
  • 22. (as an example) Once you find the correct library ("Adafruit Dotstar”), click to view the details and examples. Use the dropdown under Examples to change it to “ItsyBitsyM4Onboard”. Copy the example code (to memory) and then click the Add to Project button. Adding Dotstars
  • 23. to the project In the popup - select the Hello World project and click Add Adding Dotstars
  • 24. What happened? What happened under the hood is that this text file was updated. platformio.ini is the main setup of your project, so let’s take a look at it? Adding Dotstars
  • 25. Paste in the “ItsyBitsyM4Onboard” example
  • 26. what’s wrong? When we build the library, we get an error telling that Wire.h is missing. This is a library that is used by the Adafruit Dotstar library. This is a bug in the example we’re using. The library is already on our machine, but we need to include it. Can anyone suggest how we fix this? Errors?
  • 27. added to the top In this case, it was one of the common libraries that were needed. wire.h
  • 28. what’s wrong? The error says that 'rainbow' was not declared in this scope. But we do have a method called “rainbow”, don’t we? The problem is that this method is being used BEFORE the compiler has reached the part of the code it’s in. Let’s move our loop-method to the bottom of the file to solve this. More errors?
  • 31.
  • 32.
  • 33.
  • 34.
  • 35. If you don’t have GIT installed on your machine, you’ll see a download button Click to install GIT
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.

Editor's Notes

  1. We’ll start with everyone downloading and installing Visual Studio Code. Some of you will likely have that installed already, so help the person next to you (if required)? Lets have a raise of hands here. How many have VS Code installed already?
  2. Microsoft has changed quite a bit. In general, they have changed most of the negative buzz they had some years ago. I’m not saying this because Microsoft is a Bitraf sponsor (they are!) but I’m saying it sine that’s how I perceive them these days. They no longer try to be the guy in class that is always bragging. From what I’ve heard, they no longer charge money for the basic version of their software and OS. In general, they do a lot for good and one of these things are VS Code. I really like it and I use it for many things. The software is open and extendable so let’s start by having a look around the interface?
  3. PlatformIO is a plugin for VS Code that makes it possible to program more than 800 different microcontrollers.
  4. While that is downloading and installing - lets have a look at PlatformIO? Gary Explains… (Here we’ll show up until about 6 minutes into the video - if needed) Gary mentions Arduino and microcontrollers. That’s hardware, so let’s look closer at the hardware we’ll be using!
  5. During setup, you may encounter this dialogue. You should obviously trust yourself…
  6. Anyway - that’s a bit of background for why the hardware part of this elective is easy to use. It owes a lot to the Arduino project.
  7. Go through the main source file (the #include at the top and then the setup and loop methods) as well as the other files generated
  8. PlatformIO takes this further and provides a professional development experience.
  9. Build option in the Project Tasks menu, Build button in PlatformIO Toolbar, Task Menu: Tasks: Run Task... > PlatformIO: Build, or in the PlatformIO Toolbar, Command Palette: View: Command Palette > PlatformIO: Build, or via hotkeys control-option-b / ctrl-alt-b
  10. If you type something incorrectly, it’ll show up in the Problems-tab at the bottom. The text will also be highlighted. In this case, I’ve used a big B rather than a small, and since there is no such command - I’ll get this error.
  11. Here is another typical error. Here I’m missing a semicolon on line 5. When there are no errors, we can upload to the ESP32 microcontroller.
  12. If anything goes wrong, it’s at this step… Upload option in the Project Tasks menu, Upload button in PlatformIO Toolbar, Command Palette: View: Command Palette > PlatformIO: Upload, using the Task Menu: Tasks: Run Task... > PlatformIO: Upload, or via hotkeys: control-option-u / ctrl-alt-u:
  13. But how can we tell that this worked? Show clearing and closing terminal windows Monitor option in the Project Tasks menu, Serial Monitor button in the PlatformIO Toolbar, Command Palette: View: Command Palette > PlatformIO: Monitor, or Task Menu: Tasks: Run Task... > PlatformIO: Monitor:
  14. Note that you do not need to do the Build step. It will be done automatically if anything is changed. Just upload the code and you’re done. You can also note that the RGB LED is not longer fading through colors. This is because we have now replaced the software running on the device. It only has one program and it starts every time we apply power.
  15. It’s not a proper Hello World for hardware unless we blink a LED? Let’s extend our code a bit to add this. We’ll use two new commands: digitalRead and digitalWrite.
  16. After uploading, the builtin LED will blink. You can find more details on the build process here: https://docs.platformio.org/en/stable/tutorials/espressif32/arduino_debugging_unit_testing.html We’ll get back to parts of this at a later time in the course.
  17. So blinking a LED is fun, but how do we make a beautiful multi-colour LED work?
  18. In my case, it’s not the right library that is shown when we do this search, so I’ll have to scroll down to find the exact match. Click the name of the library
  19. We need to update the Clock and Data pin numbers. The Data pin should be 33, the Clock pin should be 21
  20. At Bitraf, we love Open Source and sharing. Sharing is caring! Let’s save the file to GitHub! Do you all have a GitHub account?
  21. If you don’t have one, we’ll set it up now. If you already have one, you can just kick back and relax while some of us create a new account (JensaKristiania). Open GitHub.com to create an account.
  22. Use your permanent email address.
  23. When you have filled out the form and done the quiz, you’ll need to confirm the email
  24. Once that is in place, you might get to this screen. Just click through and go fo the free account.
  25. When all is done, you should get to this screen and the account should be working. Now we can integrate it into VS Code!
  26. Start by clicking the Source Control icon on the left. Then click the “Publish to Github” button to see this dialogue open
  27. Start by clicking the Source Control icon on the left. Then click the “Publish to Github” button to see this dialogue open
  28. VS Code will now ask to open GitHub in your favourite browser. Press the “Allow” button.
  29. Next, you authorise the access. Make sure you use the Github account you want to integrate (if you have multiple)
  30. When that is done, you’ll be asked to open VS Code. Be sure to do that.
  31. This is the last part of the authentication process. Once you’ve pressed “Open”, we are ready to upload the files to Github!
  32. The name of the repository will be the same as the name of your project. Publish it to a Publicly available repository. If you do client work or do not want to show off what you do, you can also use a Private repository but for now we’ll keep it Public.
  33. Once the upload completes, you can go to the Github website and see the files you just backed up. Now lets do something fun that you might not know about. With your Github repository open - press the Punctuation key on your keyboard and wait a little…
  34. This will open a quite functional version of VS Code - directly in your browser! Set the defaults and browse around a bit. It’s just like on your computer, right?
  35. There’s even an Extension installer for PlatformIO, but it cannot be installed. In general - only browsing and editing code will work, but that can certainly be useful. Let’s add a comment to our src file - directly in the browser
  36. When we press CTRL+S to save the file, you’ll see an “M” next to the changed file. This means that we have Modified a file. Let’s commit that file from the Github website and back to our desktop application. Click the Source Control button and write a message in the field at the top Left corner. Now you can press the Checkmark at the top or the keyboard shortcut CTRL+Enter to commit and push the files. Now let’s go back to the VS Code application and let’s go grab the changes we just made?
  37. Since the desktop app does not know that the file has changed, we can click the three dots menu and select the “pull” option to pull down the change we just made. As you can see - most of the normal git commands are there for you. You could of course also use the command line in the terminal window also if you prefer that. I usually do all my git work on command line myself, but its really nicely integrated into VS Code, so now you’ve seen that.
  38. One last feature that is useful - you have s simple Diff-tool here as well. Make a change in your file and then click it in the list to the left (where you see the “M”). This will bring up the file last pulled from Github as well as your file. Here you’ll easily see what you changed. Imagine you work on a project and then head off into a meeting or lunch. When you come back, you’ll want to get into the code quickly and with this you can see all the changes made since last commit.
  39. To learn more about Git in VS Code, check out this tutorial