SlideShare a Scribd company logo
Little bits & node.js
IOT for beginner
Michele Capra
!
@piccoloaiutante
!
michele.capra@nearform.com
Summary
• Little bits
• Arduino
• Node.js
• Demo
• Q&A
Little bits
• Modular electronic components that
snap together via magnetic connectors
• Designed for education
• Arduino coding kit
Arduino coding kit
• 1 x arduino
• 1 x fork
• 1 x power
• 1 x button
• 2 x dimmer
• 1 x bargraph
• 1 x servo
Arduino
It's an open-source physical computing platform based on a simple
microcontroller board, and a development environment for writing
software for the board
Node.js & johnny-
five
• johnny-five is an Open Source, Firmata
Protocol based, IoT and Robotics
programming framework
• “..johnny-five wants to be a baseline
control kit for hardware projects,
allowing you the freedom to build,
grow and experiment with diverse
JavaScript libraries of your own
choice..”
Setting up Arduino
board
!
• Connect the Arduino module to the
computer using USB
• Connect power module because the
Arduino module is not powered via USB.
• Upload StandardFirmata to Arduino
board using the Arduino IDE
Demo
• Using dimmers to draw to the screen
just like an Etch-a-sketch.
Little bits in
action
• 1x Arduino
• 1x power
• 1 x fork
• 2 x dimmers
• 1 x button
The circuit
Code
• Webpage as web interface for our etch-
a-sketch (HTML5 canvas + socket.io)
• Node webserver that will read the X
and Y values from dimmers and
communicate to our client
(socket.io + johnny-five)
Server code
board.on("ready", function() {
!
joystick = new five.Joystick({
pins: ["A1", "A0"],
freq: 100
});
button=new five.Button(0);
Server code
html = fs.readFileSync('draw.html').toString();
!
server = http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/html'});
res.end(html);
});
Server code
io.listen(server).on('connection', function (socket) {
// send the X, Y values to the client
joystick.on("axismove", function(err, timestamp) {
console.log(this.fixed.x, this.fixed.y);
socket.emit('drawing', this.fixed);
});
!
button.on("press", function(value){
socket.emit('clear');
});
});
Client code
!
socket.on('clear', function(){
context.clearRect(0,0,600,400);
context.beginPath();
});
!
socket.on('drawing', function (data) {
$('#status').html('Connected (x: ' + data.x +
', y: ' + data.y + ')');
// scale values to match canvas size
data.x *= 600;
data.y *= 400;
// if values have changed, draw a line to the new position
if (prev && (prev.x != data.x || prev.y != data.y)) {
context.moveTo(prev.x, prev.y);
context.lineTo(data.x, data.y);
context.stroke();
}
prev = data;
});
Demo time
That’s all
Credits
• little-bits-js:Anna Gerber has created
several exercise that you could do
with little bits, included the etch-a-
sketch that you’ve seen (https://
github.com/AnnaGerber/little-bits-js)
• Images of bits used in this
presentation have been sourced from
littlebits.cc and used under a
Creative Commons CC-BY-SA license.

More Related Content

Similar to Little bits & node.js IOT for beginner

Using OSVR to Support (practically) Any Device in VR/AR
Using OSVR to Support (practically) Any Device in VR/ARUsing OSVR to Support (practically) Any Device in VR/AR
Using OSVR to Support (practically) Any Device in VR/AR
Yuval Boger
 
Android and Arduio mixed with Breakout js
Android and Arduio mixed with Breakout jsAndroid and Arduio mixed with Breakout js
Android and Arduio mixed with Breakout js
musart Park
 
Overview of the Intel® Internet of Things Developer Kit
Overview of the Intel® Internet of Things Developer KitOverview of the Intel® Internet of Things Developer Kit
Overview of the Intel® Internet of Things Developer Kit
Intel® Software
 
E yantra robot abstractions
E yantra robot abstractionsE yantra robot abstractions
E yantra robot abstractionsAkshar Desai
 
Massively Social != Massively Multiplayer
Massively Social != Massively MultiplayerMassively Social != Massively Multiplayer
Massively Social != Massively Multiplayer
Paul Furio
 
Electric Imp - Hackathon Intro
Electric Imp - Hackathon IntroElectric Imp - Hackathon Intro
Electric Imp - Hackathon Intro
Matt Haines
 
Node azure
Node azureNode azure
Node azure
Emanuele DelBono
 
JavaOne 2015 : How I Rediscovered My Coding Mojo by Building an IoT/Robotics ...
JavaOne 2015 : How I Rediscovered My Coding Mojo by Building an IoT/Robotics ...JavaOne 2015 : How I Rediscovered My Coding Mojo by Building an IoT/Robotics ...
JavaOne 2015 : How I Rediscovered My Coding Mojo by Building an IoT/Robotics ...
Mark West
 
IOT beginnners
IOT beginnnersIOT beginnners
IOT beginnners
udhayakumarc1
 
IOT beginnners
IOT beginnnersIOT beginnners
IOT beginnners
udhayakumarc1
 
IoT Node-Red Presentation
IoT  Node-Red PresentationIoT  Node-Red Presentation
IoT Node-Red Presentation
The IOT Academy
 
Robots conf microcontroller and iot survey
Robots conf   microcontroller and iot surveyRobots conf   microcontroller and iot survey
Robots conf microcontroller and iot survey
Matt Haines
 
DIY IoT: Raspberry PI 2 + Windows 10 for IoT devices + Microsoft Azure
DIY IoT: Raspberry PI 2 + Windows 10 for IoT devices + Microsoft AzureDIY IoT: Raspberry PI 2 + Windows 10 for IoT devices + Microsoft Azure
DIY IoT: Raspberry PI 2 + Windows 10 for IoT devices + Microsoft Azure
Intersog
 
Building a Thought Controlled Drone
Building a Thought Controlled DroneBuilding a Thought Controlled Drone
Building a Thought Controlled Drone
Jim McKeeth
 
Hacking with the Raspberry Pi and Windows 10 IoT Core
Hacking with the Raspberry Pi and Windows 10 IoT CoreHacking with the Raspberry Pi and Windows 10 IoT Core
Hacking with the Raspberry Pi and Windows 10 IoT Core
Nick Landry
 
How To Electrocute Yourself using the Internet
How To Electrocute Yourself using the InternetHow To Electrocute Yourself using the Internet
How To Electrocute Yourself using the Internet
Alexander Roche
 
Controlling your home with IoT Hub
Controlling your home with IoT HubControlling your home with IoT Hub
Controlling your home with IoT Hub
Stamatis Pavlis
 
Internet of Things 101 - Part II
Internet of Things 101 - Part IIInternet of Things 101 - Part II
Internet of Things 101 - Part II
Yoonseok Hur
 
Edge Of The Web
Edge Of The WebEdge Of The Web
Edge Of The Web
Justin Mclean
 

Similar to Little bits & node.js IOT for beginner (20)

Using OSVR to Support (practically) Any Device in VR/AR
Using OSVR to Support (practically) Any Device in VR/ARUsing OSVR to Support (practically) Any Device in VR/AR
Using OSVR to Support (practically) Any Device in VR/AR
 
Android and Arduio mixed with Breakout js
Android and Arduio mixed with Breakout jsAndroid and Arduio mixed with Breakout js
Android and Arduio mixed with Breakout js
 
Overview of the Intel® Internet of Things Developer Kit
Overview of the Intel® Internet of Things Developer KitOverview of the Intel® Internet of Things Developer Kit
Overview of the Intel® Internet of Things Developer Kit
 
E yantra robot abstractions
E yantra robot abstractionsE yantra robot abstractions
E yantra robot abstractions
 
Massively Social != Massively Multiplayer
Massively Social != Massively MultiplayerMassively Social != Massively Multiplayer
Massively Social != Massively Multiplayer
 
Electric Imp - Hackathon Intro
Electric Imp - Hackathon IntroElectric Imp - Hackathon Intro
Electric Imp - Hackathon Intro
 
Node azure
Node azureNode azure
Node azure
 
JavaOne 2015 : How I Rediscovered My Coding Mojo by Building an IoT/Robotics ...
JavaOne 2015 : How I Rediscovered My Coding Mojo by Building an IoT/Robotics ...JavaOne 2015 : How I Rediscovered My Coding Mojo by Building an IoT/Robotics ...
JavaOne 2015 : How I Rediscovered My Coding Mojo by Building an IoT/Robotics ...
 
IOT beginnners
IOT beginnnersIOT beginnners
IOT beginnners
 
IOT beginnners
IOT beginnnersIOT beginnners
IOT beginnners
 
IoT Node-Red Presentation
IoT  Node-Red PresentationIoT  Node-Red Presentation
IoT Node-Red Presentation
 
Robots conf microcontroller and iot survey
Robots conf   microcontroller and iot surveyRobots conf   microcontroller and iot survey
Robots conf microcontroller and iot survey
 
Tablet pc
Tablet pcTablet pc
Tablet pc
 
DIY IoT: Raspberry PI 2 + Windows 10 for IoT devices + Microsoft Azure
DIY IoT: Raspberry PI 2 + Windows 10 for IoT devices + Microsoft AzureDIY IoT: Raspberry PI 2 + Windows 10 for IoT devices + Microsoft Azure
DIY IoT: Raspberry PI 2 + Windows 10 for IoT devices + Microsoft Azure
 
Building a Thought Controlled Drone
Building a Thought Controlled DroneBuilding a Thought Controlled Drone
Building a Thought Controlled Drone
 
Hacking with the Raspberry Pi and Windows 10 IoT Core
Hacking with the Raspberry Pi and Windows 10 IoT CoreHacking with the Raspberry Pi and Windows 10 IoT Core
Hacking with the Raspberry Pi and Windows 10 IoT Core
 
How To Electrocute Yourself using the Internet
How To Electrocute Yourself using the InternetHow To Electrocute Yourself using the Internet
How To Electrocute Yourself using the Internet
 
Controlling your home with IoT Hub
Controlling your home with IoT HubControlling your home with IoT Hub
Controlling your home with IoT Hub
 
Internet of Things 101 - Part II
Internet of Things 101 - Part IIInternet of Things 101 - Part II
Internet of Things 101 - Part II
 
Edge Of The Web
Edge Of The WebEdge Of The Web
Edge Of The Web
 

More from Michele Capra

Nodeschool italy at codemotion
Nodeschool italy at codemotionNodeschool italy at codemotion
Nodeschool italy at codemotion
Michele Capra
 
Testing Windows Phone 8.1 app with unit test and Coded UI test
Testing Windows Phone 8.1 app with unit test and Coded UI testTesting Windows Phone 8.1 app with unit test and Coded UI test
Testing Windows Phone 8.1 app with unit test and Coded UI test
Michele Capra
 
Porting business apps to Windows Phone
Porting business apps to Windows PhonePorting business apps to Windows Phone
Porting business apps to Windows Phone
Michele Capra
 
The magic of Dynamic in Nancy Fx
The magic of Dynamic in Nancy FxThe magic of Dynamic in Nancy Fx
The magic of Dynamic in Nancy Fx
Michele Capra
 
Building High Performance and Reliable Windows Phone 8 Apps
Building High Performance and Reliable Windows Phone 8 AppsBuilding High Performance and Reliable Windows Phone 8 Apps
Building High Performance and Reliable Windows Phone 8 Apps
Michele Capra
 
Test and profile your Windows Phone 8 App
Test and profile your Windows Phone 8 AppTest and profile your Windows Phone 8 App
Test and profile your Windows Phone 8 App
Michele Capra
 
Getting started with Windows Phone 7 and unit test
Getting started with Windows Phone 7 and unit testGetting started with Windows Phone 7 and unit test
Getting started with Windows Phone 7 and unit test
Michele Capra
 
Introduzione a Node.js
Introduzione a Node.jsIntroduzione a Node.js
Introduzione a Node.js
Michele Capra
 
Developing application for Windows Phone 7 in TDD
Developing application for Windows Phone 7 in TDDDeveloping application for Windows Phone 7 in TDD
Developing application for Windows Phone 7 in TDD
Michele Capra
 
Windows Phone 7 Development
Windows Phone 7 DevelopmentWindows Phone 7 Development
Windows Phone 7 Development
Michele Capra
 
My Final Dissertation
My Final DissertationMy Final Dissertation
My Final Dissertation
Michele Capra
 

More from Michele Capra (11)

Nodeschool italy at codemotion
Nodeschool italy at codemotionNodeschool italy at codemotion
Nodeschool italy at codemotion
 
Testing Windows Phone 8.1 app with unit test and Coded UI test
Testing Windows Phone 8.1 app with unit test and Coded UI testTesting Windows Phone 8.1 app with unit test and Coded UI test
Testing Windows Phone 8.1 app with unit test and Coded UI test
 
Porting business apps to Windows Phone
Porting business apps to Windows PhonePorting business apps to Windows Phone
Porting business apps to Windows Phone
 
The magic of Dynamic in Nancy Fx
The magic of Dynamic in Nancy FxThe magic of Dynamic in Nancy Fx
The magic of Dynamic in Nancy Fx
 
Building High Performance and Reliable Windows Phone 8 Apps
Building High Performance and Reliable Windows Phone 8 AppsBuilding High Performance and Reliable Windows Phone 8 Apps
Building High Performance and Reliable Windows Phone 8 Apps
 
Test and profile your Windows Phone 8 App
Test and profile your Windows Phone 8 AppTest and profile your Windows Phone 8 App
Test and profile your Windows Phone 8 App
 
Getting started with Windows Phone 7 and unit test
Getting started with Windows Phone 7 and unit testGetting started with Windows Phone 7 and unit test
Getting started with Windows Phone 7 and unit test
 
Introduzione a Node.js
Introduzione a Node.jsIntroduzione a Node.js
Introduzione a Node.js
 
Developing application for Windows Phone 7 in TDD
Developing application for Windows Phone 7 in TDDDeveloping application for Windows Phone 7 in TDD
Developing application for Windows Phone 7 in TDD
 
Windows Phone 7 Development
Windows Phone 7 DevelopmentWindows Phone 7 Development
Windows Phone 7 Development
 
My Final Dissertation
My Final DissertationMy Final Dissertation
My Final Dissertation
 

Recently uploaded

GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
Bhaskar Mitra
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 

Recently uploaded (20)

GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 

Little bits & node.js IOT for beginner

  • 1. Little bits & node.js IOT for beginner Michele Capra ! @piccoloaiutante ! michele.capra@nearform.com
  • 2. Summary • Little bits • Arduino • Node.js • Demo • Q&A
  • 3. Little bits • Modular electronic components that snap together via magnetic connectors • Designed for education • Arduino coding kit
  • 4. Arduino coding kit • 1 x arduino • 1 x fork • 1 x power • 1 x button • 2 x dimmer • 1 x bargraph • 1 x servo
  • 5. Arduino It's an open-source physical computing platform based on a simple microcontroller board, and a development environment for writing software for the board
  • 6. Node.js & johnny- five • johnny-five is an Open Source, Firmata Protocol based, IoT and Robotics programming framework • “..johnny-five wants to be a baseline control kit for hardware projects, allowing you the freedom to build, grow and experiment with diverse JavaScript libraries of your own choice..”
  • 7. Setting up Arduino board ! • Connect the Arduino module to the computer using USB • Connect power module because the Arduino module is not powered via USB. • Upload StandardFirmata to Arduino board using the Arduino IDE
  • 8. Demo • Using dimmers to draw to the screen just like an Etch-a-sketch.
  • 9. Little bits in action • 1x Arduino • 1x power • 1 x fork • 2 x dimmers • 1 x button
  • 11. Code • Webpage as web interface for our etch- a-sketch (HTML5 canvas + socket.io) • Node webserver that will read the X and Y values from dimmers and communicate to our client (socket.io + johnny-five)
  • 12. Server code board.on("ready", function() { ! joystick = new five.Joystick({ pins: ["A1", "A0"], freq: 100 }); button=new five.Button(0);
  • 13. Server code html = fs.readFileSync('draw.html').toString(); ! server = http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/html'}); res.end(html); });
  • 14. Server code io.listen(server).on('connection', function (socket) { // send the X, Y values to the client joystick.on("axismove", function(err, timestamp) { console.log(this.fixed.x, this.fixed.y); socket.emit('drawing', this.fixed); }); ! button.on("press", function(value){ socket.emit('clear'); }); });
  • 15. Client code ! socket.on('clear', function(){ context.clearRect(0,0,600,400); context.beginPath(); }); ! socket.on('drawing', function (data) { $('#status').html('Connected (x: ' + data.x + ', y: ' + data.y + ')'); // scale values to match canvas size data.x *= 600; data.y *= 400; // if values have changed, draw a line to the new position if (prev && (prev.x != data.x || prev.y != data.y)) { context.moveTo(prev.x, prev.y); context.lineTo(data.x, data.y); context.stroke(); } prev = data; });
  • 18. Credits • little-bits-js:Anna Gerber has created several exercise that you could do with little bits, included the etch-a- sketch that you’ve seen (https:// github.com/AnnaGerber/little-bits-js) • Images of bits used in this presentation have been sourced from littlebits.cc and used under a Creative Commons CC-BY-SA license.