SlideShare a Scribd company logo
1 of 13
Lorenzo Maiorfi

Modern OOP embedded development with
.NET Micro Framework
maiorfi@innovactive.it – www.innovactive.it www.tinyclr.it
What does «embedded development» actually mean?
Lorenzo Maiorfi

maiorfi@innovactive.it – www.innovactive.it
www.tinyclr.it

• Small Hardware components…
•

Microcontrollers (microprocessor cores driving
electrical analog/digital peripherals)
•
•
•

small (about 1 square cm)
cheap (€1-10 each)
low-power (about 50-100 uA per MHz)

• External boards/modules/IC
•
•

running specific tasks (i.e. sensors, actuators)
bound via some communication channel (network,
serial port, CAN, I2C, SPI, etc)
What does «embedded development» actually mean?
Lorenzo Maiorfi

maiorfi@innovactive.it – www.innovactive.it
www.tinyclr.it

• …running small software «modules»
•

Native firmware
•
•
•

•

Hard to write/debug/maintain
Vendor/platform specific (not portable)
Uses «old» languages/paradigms (C, assembler, core
registers access, memory-based actions, etc)

Managed firmware
•
•
•
•

Easy to write/debug/maintain
Portable
Uses OOP/OOD concepts
Abstracts both «machine model» and interactions
with other «actors» of whole solution
Introducing .NET Micro Framework
Lorenzo Maiorfi

maiorfi@innovactive.it – www.innovactive.it
www.tinyclr.it

An open-source platform (runtime/libraries , toolchain
and IDE) that excels in:
• Productivity
– Visual Studio IDE, C#/VB.NET compilers, debugger and
emulator make up the most productive suite on the embedded
market

•

Reliability
– managed runtime keeps under control all application layers

•

Portability
– could be ported to all known technologies, at this time covers
most microcontrollers whose core is based on 32 bit ARM™

•

Support
– open-source under Apache 2.0 license, contains many
community-provided resources
How to write applications with .NET Micro Framework
Lorenzo Maiorfi

maiorfi@innovactive.it – www.innovactive.it
www.tinyclr.it

1. Developer writes code by mean of high-level languages
such as C# or VB.NET
2. Compiler generates one or more «assemblies»
3. Assemblies binary images are stored in device flash (i.e.
non-volatile) memory
4. Once reset, device runs a bootloader, that on its turn
fires managed runtime (TinyCLR)
5. TinyCLR loads both framework and «user» assemblies,
and soon after it runs entry-point method, i.e. the
«Main()»
Demo #1 – Getting Started
Lorenzo Maiorfi

DEMO
Hello,world
(with 3 different patterns)
white led

button
OOP/OOD with .NET Micro Framework
Lorenzo Maiorfi

maiorfi@innovactive.it – www.innovactive.it
www.tinyclr.it

• OOP/OOD is very suitable for embedded development,
since it naturally maps physical objects to software
models, by mean of classes, objects and interfaces
• Encapsulation allows for better component isolation
(black-box model)
• Inheritance allows for better code reuse when using
several «variants/flavors» of same component
• Polymorphism allows for a better way to connect objects,
by mean of «outlet» abstraction, i.e. interfaces
OOP/OOD with .NET Micro Framework
Lorenzo Maiorfi

maiorfi@innovactive.it – www.innovactive.it
www.tinyclr.it

We’re going to apply this paradigm on a simple “devicedriver” for a small integrated-circuit (IC): MCP3201 ADC
1. Do some “lab” (quick & dirty demos, test SPIcommunication with a scope, etc)
2. Encapsulate functionalities into a class
3. Add features (such as async events in our case) via
inheritance
4. Extract “Interfaces” (i.e. abstract behavior)
5. Re-implement Interfaces differently
Demo #2 – OOP/OOD Demo
Lorenzo Maiorfi

DEMO
ADC Driver
This is a POT to change voltage

+
This is MCP3201!
IoT/M2M as the killer app for .NET Micro Framework
Lorenzo Maiorfi

maiorfi@innovactive.it – www.innovactive.it
www.tinyclr.it

.NET Micro Framework killer applications are IoT/M2M
systems, since:
• It has a rich TCP/IP network stack
• There are many libraries implementing both IoT
protocols (first and foremost HTTP REST, both client and
server) and M2M protocols (primarily MQTT & CoAP)
• There are many libraries that allow for «bridging» across
other technologies, such as ZigBee, Bluetooth, BLE,
vendor-specific 2.4GHz/433MHz radio modules (we’re
developing Z-Wave stack, too)
• OOP features are great for building systems made of
devices that interact in an abstract way!
IoT/M2M with mqtt & node-red
Lorenzo Maiorfi

maiorfi@innovactive.it – www.innovactive.it
www.tinyclr.it

• Mqtt is a lightweight pub/sub protocol whose primary
focus is communication in IoT/M2M applications
• Mqtt client libs are available for all platforms/languages
• Node-Red is an open software (based on Node.js) whose
purpose is to design and run “flows”
• Flows are made of “nodes” targeted to specific functions
• Among built-in nodes: tcp-in/out, udp-in/out, httpin/out, mqtt-in/out, twitter, mail, files, mongodb, etc.
• Many “logic” node blocks (function, template, switch)
• You can write (and debug, via node-inspector) your own
nodes, too!
Demo #3 – IoT/M2M Demo
Lorenzo Maiorfi

APIs

Node-Red

http
“javascript”
Remote #1

mqtt
Mqtt Broker

Remote #2

mqtt

mqtt

Radio
Bridge

radio
websockets
Robot
Thank you!
Lorenzo Maiorfi
maiorfi@innovactive.it – www.innovactive.it - @innovactive
Tech Blog: www.tinyclr.it - @tinyclr

More Related Content

Similar to Codemotion 2013 Madrid - Modern OOP embedded development with .NET Micro Framework

Null mumbai-iot-workshop
Null mumbai-iot-workshopNull mumbai-iot-workshop
Null mumbai-iot-workshopNitesh Malviya
 
IoT Studio #1: Protocols introduction and connected jukebox
IoT Studio #1: Protocols introduction and connected jukeboxIoT Studio #1: Protocols introduction and connected jukebox
IoT Studio #1: Protocols introduction and connected jukeboxMickaël Rémond
 
Using Eclipse and Lua for the Internet of Things with Eclipse Koneki, Mihini ...
Using Eclipse and Lua for the Internet of Things with Eclipse Koneki, Mihini ...Using Eclipse and Lua for the Internet of Things with Eclipse Koneki, Mihini ...
Using Eclipse and Lua for the Internet of Things with Eclipse Koneki, Mihini ...Benjamin Cabé
 
Open source building blocks for the Internet of Things - Jfokus 2013
Open source building blocks for the Internet of Things - Jfokus 2013Open source building blocks for the Internet of Things - Jfokus 2013
Open source building blocks for the Internet of Things - Jfokus 2013Benjamin Cabé
 
Using Eclipse and Lua for the Internet of Things - EclipseDay Googleplex 2012
Using Eclipse and Lua for the Internet of Things - EclipseDay Googleplex 2012Using Eclipse and Lua for the Internet of Things - EclipseDay Googleplex 2012
Using Eclipse and Lua for the Internet of Things - EclipseDay Googleplex 2012Benjamin Cabé
 
RIOT: towards open source, secure DevOps on microcontroller-based IoT
RIOT: towards open source, secure DevOps on microcontroller-based IoTRIOT: towards open source, secure DevOps on microcontroller-based IoT
RIOT: towards open source, secure DevOps on microcontroller-based IoTAlexandre Abadie
 
#OSSPARIS19 : RIOT: towards open source, secure DevOps on microcontroller-bas...
#OSSPARIS19 : RIOT: towards open source, secure DevOps on microcontroller-bas...#OSSPARIS19 : RIOT: towards open source, secure DevOps on microcontroller-bas...
#OSSPARIS19 : RIOT: towards open source, secure DevOps on microcontroller-bas...Paris Open Source Summit
 
Contiki IoT simulation
Contiki IoT simulationContiki IoT simulation
Contiki IoT simulationnabati
 
Internet of Things – Contiki.pdf
Internet of Things – Contiki.pdfInternet of Things – Contiki.pdf
Internet of Things – Contiki.pdfSudhanshiBakre1
 
Matteo Valoriani, Antimo Musone - The Future of Factory - Codemotion Rome 2019
Matteo Valoriani, Antimo Musone - The Future of Factory - Codemotion Rome 2019Matteo Valoriani, Antimo Musone - The Future of Factory - Codemotion Rome 2019
Matteo Valoriani, Antimo Musone - The Future of Factory - Codemotion Rome 2019Codemotion
 
Smart home and smartfactory intelligent systems
Smart home and smartfactory intelligent systemsSmart home and smartfactory intelligent systems
Smart home and smartfactory intelligent systemsLorenzo Maiorfi
 
Unit 6 Operating System TEIT Savitribai Phule Pune University by Tushar B Kute
Unit 6 Operating System TEIT Savitribai Phule Pune University by Tushar B KuteUnit 6 Operating System TEIT Savitribai Phule Pune University by Tushar B Kute
Unit 6 Operating System TEIT Savitribai Phule Pune University by Tushar B KuteTushar B Kute
 
Italian Alt.Net Conference MonoTouch Session
Italian Alt.Net Conference MonoTouch SessionItalian Alt.Net Conference MonoTouch Session
Italian Alt.Net Conference MonoTouch SessionChris Hardy
 
Building IoT devices with ARM mbed - RISE Manchester
Building IoT devices with ARM mbed - RISE ManchesterBuilding IoT devices with ARM mbed - RISE Manchester
Building IoT devices with ARM mbed - RISE ManchesterJan Jongboom
 
Developers’ mDay u Banjoj Luci - Janko Isidorović, Mainflux – Unified IoT Pl...
Developers’ mDay u Banjoj Luci - Janko Isidorović, Mainflux –  Unified IoT Pl...Developers’ mDay u Banjoj Luci - Janko Isidorović, Mainflux –  Unified IoT Pl...
Developers’ mDay u Banjoj Luci - Janko Isidorović, Mainflux – Unified IoT Pl...mCloud
 
Introduction to Embedded Systems and Microcontrollers
Introduction to Embedded Systems and MicrocontrollersIntroduction to Embedded Systems and Microcontrollers
Introduction to Embedded Systems and MicrocontrollersIslam Samir
 
node.js is made for IoT - node.hh 07/16, Hamburg by Michael Kuehne
node.js is made for IoT - node.hh 07/16, Hamburg by Michael Kuehnenode.js is made for IoT - node.hh 07/16, Hamburg by Michael Kuehne
node.js is made for IoT - node.hh 07/16, Hamburg by Michael KuehneMichael Kuehne-Schlinkert
 

Similar to Codemotion 2013 Madrid - Modern OOP embedded development with .NET Micro Framework (20)

Null mumbai-iot-workshop
Null mumbai-iot-workshopNull mumbai-iot-workshop
Null mumbai-iot-workshop
 
IoT Studio #1: Protocols introduction and connected jukebox
IoT Studio #1: Protocols introduction and connected jukeboxIoT Studio #1: Protocols introduction and connected jukebox
IoT Studio #1: Protocols introduction and connected jukebox
 
Using Eclipse and Lua for the Internet of Things with Eclipse Koneki, Mihini ...
Using Eclipse and Lua for the Internet of Things with Eclipse Koneki, Mihini ...Using Eclipse and Lua for the Internet of Things with Eclipse Koneki, Mihini ...
Using Eclipse and Lua for the Internet of Things with Eclipse Koneki, Mihini ...
 
Open source building blocks for the Internet of Things - Jfokus 2013
Open source building blocks for the Internet of Things - Jfokus 2013Open source building blocks for the Internet of Things - Jfokus 2013
Open source building blocks for the Internet of Things - Jfokus 2013
 
Using Eclipse and Lua for the Internet of Things - EclipseDay Googleplex 2012
Using Eclipse and Lua for the Internet of Things - EclipseDay Googleplex 2012Using Eclipse and Lua for the Internet of Things - EclipseDay Googleplex 2012
Using Eclipse and Lua for the Internet of Things - EclipseDay Googleplex 2012
 
RIOT: towards open source, secure DevOps on microcontroller-based IoT
RIOT: towards open source, secure DevOps on microcontroller-based IoTRIOT: towards open source, secure DevOps on microcontroller-based IoT
RIOT: towards open source, secure DevOps on microcontroller-based IoT
 
#OSSPARIS19 : RIOT: towards open source, secure DevOps on microcontroller-bas...
#OSSPARIS19 : RIOT: towards open source, secure DevOps on microcontroller-bas...#OSSPARIS19 : RIOT: towards open source, secure DevOps on microcontroller-bas...
#OSSPARIS19 : RIOT: towards open source, secure DevOps on microcontroller-bas...
 
Lecture 9
Lecture 9Lecture 9
Lecture 9
 
Contiki IoT simulation
Contiki IoT simulationContiki IoT simulation
Contiki IoT simulation
 
Internet of Things – Contiki.pdf
Internet of Things – Contiki.pdfInternet of Things – Contiki.pdf
Internet of Things – Contiki.pdf
 
Matteo Valoriani, Antimo Musone - The Future of Factory - Codemotion Rome 2019
Matteo Valoriani, Antimo Musone - The Future of Factory - Codemotion Rome 2019Matteo Valoriani, Antimo Musone - The Future of Factory - Codemotion Rome 2019
Matteo Valoriani, Antimo Musone - The Future of Factory - Codemotion Rome 2019
 
Smart home and smartfactory intelligent systems
Smart home and smartfactory intelligent systemsSmart home and smartfactory intelligent systems
Smart home and smartfactory intelligent systems
 
Unit 6 Operating System TEIT Savitribai Phule Pune University by Tushar B Kute
Unit 6 Operating System TEIT Savitribai Phule Pune University by Tushar B KuteUnit 6 Operating System TEIT Savitribai Phule Pune University by Tushar B Kute
Unit 6 Operating System TEIT Savitribai Phule Pune University by Tushar B Kute
 
Midori ppt
Midori pptMidori ppt
Midori ppt
 
Italian Alt.Net Conference MonoTouch Session
Italian Alt.Net Conference MonoTouch SessionItalian Alt.Net Conference MonoTouch Session
Italian Alt.Net Conference MonoTouch Session
 
Building IoT devices with ARM mbed - RISE Manchester
Building IoT devices with ARM mbed - RISE ManchesterBuilding IoT devices with ARM mbed - RISE Manchester
Building IoT devices with ARM mbed - RISE Manchester
 
Developers’ mDay u Banjoj Luci - Janko Isidorović, Mainflux – Unified IoT Pl...
Developers’ mDay u Banjoj Luci - Janko Isidorović, Mainflux –  Unified IoT Pl...Developers’ mDay u Banjoj Luci - Janko Isidorović, Mainflux –  Unified IoT Pl...
Developers’ mDay u Banjoj Luci - Janko Isidorović, Mainflux – Unified IoT Pl...
 
Introduction to Embedded Systems and Microcontrollers
Introduction to Embedded Systems and MicrocontrollersIntroduction to Embedded Systems and Microcontrollers
Introduction to Embedded Systems and Microcontrollers
 
Construct an Efficient and Secure Microkernel for IoT
Construct an Efficient and Secure Microkernel for IoTConstruct an Efficient and Secure Microkernel for IoT
Construct an Efficient and Secure Microkernel for IoT
 
node.js is made for IoT - node.hh 07/16, Hamburg by Michael Kuehne
node.js is made for IoT - node.hh 07/16, Hamburg by Michael Kuehnenode.js is made for IoT - node.hh 07/16, Hamburg by Michael Kuehne
node.js is made for IoT - node.hh 07/16, Hamburg by Michael Kuehne
 

Recently uploaded

My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetEnjoy Anytime
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 

Recently uploaded (20)

My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 

Codemotion 2013 Madrid - Modern OOP embedded development with .NET Micro Framework

  • 1. Lorenzo Maiorfi Modern OOP embedded development with .NET Micro Framework maiorfi@innovactive.it – www.innovactive.it www.tinyclr.it
  • 2. What does «embedded development» actually mean? Lorenzo Maiorfi maiorfi@innovactive.it – www.innovactive.it www.tinyclr.it • Small Hardware components… • Microcontrollers (microprocessor cores driving electrical analog/digital peripherals) • • • small (about 1 square cm) cheap (€1-10 each) low-power (about 50-100 uA per MHz) • External boards/modules/IC • • running specific tasks (i.e. sensors, actuators) bound via some communication channel (network, serial port, CAN, I2C, SPI, etc)
  • 3. What does «embedded development» actually mean? Lorenzo Maiorfi maiorfi@innovactive.it – www.innovactive.it www.tinyclr.it • …running small software «modules» • Native firmware • • • • Hard to write/debug/maintain Vendor/platform specific (not portable) Uses «old» languages/paradigms (C, assembler, core registers access, memory-based actions, etc) Managed firmware • • • • Easy to write/debug/maintain Portable Uses OOP/OOD concepts Abstracts both «machine model» and interactions with other «actors» of whole solution
  • 4. Introducing .NET Micro Framework Lorenzo Maiorfi maiorfi@innovactive.it – www.innovactive.it www.tinyclr.it An open-source platform (runtime/libraries , toolchain and IDE) that excels in: • Productivity – Visual Studio IDE, C#/VB.NET compilers, debugger and emulator make up the most productive suite on the embedded market • Reliability – managed runtime keeps under control all application layers • Portability – could be ported to all known technologies, at this time covers most microcontrollers whose core is based on 32 bit ARM™ • Support – open-source under Apache 2.0 license, contains many community-provided resources
  • 5. How to write applications with .NET Micro Framework Lorenzo Maiorfi maiorfi@innovactive.it – www.innovactive.it www.tinyclr.it 1. Developer writes code by mean of high-level languages such as C# or VB.NET 2. Compiler generates one or more «assemblies» 3. Assemblies binary images are stored in device flash (i.e. non-volatile) memory 4. Once reset, device runs a bootloader, that on its turn fires managed runtime (TinyCLR) 5. TinyCLR loads both framework and «user» assemblies, and soon after it runs entry-point method, i.e. the «Main()»
  • 6. Demo #1 – Getting Started Lorenzo Maiorfi DEMO Hello,world (with 3 different patterns) white led button
  • 7. OOP/OOD with .NET Micro Framework Lorenzo Maiorfi maiorfi@innovactive.it – www.innovactive.it www.tinyclr.it • OOP/OOD is very suitable for embedded development, since it naturally maps physical objects to software models, by mean of classes, objects and interfaces • Encapsulation allows for better component isolation (black-box model) • Inheritance allows for better code reuse when using several «variants/flavors» of same component • Polymorphism allows for a better way to connect objects, by mean of «outlet» abstraction, i.e. interfaces
  • 8. OOP/OOD with .NET Micro Framework Lorenzo Maiorfi maiorfi@innovactive.it – www.innovactive.it www.tinyclr.it We’re going to apply this paradigm on a simple “devicedriver” for a small integrated-circuit (IC): MCP3201 ADC 1. Do some “lab” (quick & dirty demos, test SPIcommunication with a scope, etc) 2. Encapsulate functionalities into a class 3. Add features (such as async events in our case) via inheritance 4. Extract “Interfaces” (i.e. abstract behavior) 5. Re-implement Interfaces differently
  • 9. Demo #2 – OOP/OOD Demo Lorenzo Maiorfi DEMO ADC Driver This is a POT to change voltage + This is MCP3201!
  • 10. IoT/M2M as the killer app for .NET Micro Framework Lorenzo Maiorfi maiorfi@innovactive.it – www.innovactive.it www.tinyclr.it .NET Micro Framework killer applications are IoT/M2M systems, since: • It has a rich TCP/IP network stack • There are many libraries implementing both IoT protocols (first and foremost HTTP REST, both client and server) and M2M protocols (primarily MQTT & CoAP) • There are many libraries that allow for «bridging» across other technologies, such as ZigBee, Bluetooth, BLE, vendor-specific 2.4GHz/433MHz radio modules (we’re developing Z-Wave stack, too) • OOP features are great for building systems made of devices that interact in an abstract way!
  • 11. IoT/M2M with mqtt & node-red Lorenzo Maiorfi maiorfi@innovactive.it – www.innovactive.it www.tinyclr.it • Mqtt is a lightweight pub/sub protocol whose primary focus is communication in IoT/M2M applications • Mqtt client libs are available for all platforms/languages • Node-Red is an open software (based on Node.js) whose purpose is to design and run “flows” • Flows are made of “nodes” targeted to specific functions • Among built-in nodes: tcp-in/out, udp-in/out, httpin/out, mqtt-in/out, twitter, mail, files, mongodb, etc. • Many “logic” node blocks (function, template, switch) • You can write (and debug, via node-inspector) your own nodes, too!
  • 12. Demo #3 – IoT/M2M Demo Lorenzo Maiorfi APIs Node-Red http “javascript” Remote #1 mqtt Mqtt Broker Remote #2 mqtt mqtt Radio Bridge radio websockets Robot
  • 13. Thank you! Lorenzo Maiorfi maiorfi@innovactive.it – www.innovactive.it - @innovactive Tech Blog: www.tinyclr.it - @tinyclr