SlideShare a Scribd company logo
Curso sobre Arduino:
Ethernet
11-7-2014
ElCacharreo.com José Antonio Vacas
Arduino Básico: Presente
ElCacharreo.com Arduino
Básico
Arduino Básico: Presente
ElCacharreo.com Arduino
Básico
javacasm@elcacharreo.com
twitter
linkedin
blog
José Antonio Vacas Martínez
Arduino Básico: Ethernet
ElCacharreo.com Arduino
Básico
Puede utilizarse tanto como cliente
como servidor, es decir enviado o
recibiendo datos
Soporta hasta 4 conexiones
simultáneas
http://www.instructables.
com/id/Arduino-Ethernet-Shield-
Tutorial/?ALLSTEPS
Arduino Básico: Ethernet server
ElCacharreo.com Arduino
Básico
#include <Ethernet.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 10, 0, 0, 177 }; //the IP address for the shield:
byte gateway[] = { 10, 0, 0, 1 };// the router's gateway address:
byte subnet[] = { 255, 255, 0, 0 };// the subnet:
Server server = Server(23);
void setup(){
// initialize the ethernet device
Ethernet.begin(mac, ip, gateway, subnet);
// start listening for clients
server.begin();}
void loop(){
// if an incoming client connects, there will be bytes available to read:
Client client = server.available();
if (client == true) {
// read bytes from the incoming client and write them back
// to any clients connected to the server:
server.write(client.read());
}
}
Ejemplos Ethernet: webserver
ElCacharreo.com Arduino
Básico
void loop() { // listen for incoming clients
EthernetClient client = server.available();
if (client) {
Serial.println("new client");
boolean currentLineIsBlank = true; // an http request ends with a blank line
while (client.connected()) {
if (client.available()) {
char c = client.read(); Serial.write(c);
if (c == 'n' && currentLineIsBlank) { // send a standard http response header
client.println("HTTP/1.1 200 OK"); client.println("Content-Type: text/html"); client.println("Connection: close");
client.println(); client.println("<!DOCTYPE HTML>"); client.println("<html>");
// add a meta refresh tag, so the browser pulls again every 5 seconds:
client.println("<meta http-equiv="refresh" content="5">");
// output the value of each analog input pin
for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
int sensorReading = analogRead(analogChannel);
client.print("analog input "); client.print(analogChannel); client.print(" is "); client.print(sensorReading);
client.println("<br />");
}
client.println("</html>");
break;
}
if (c == 'n') { // you're starting a new line
currentLineIsBlank = true; }
else if (c != 'r') { // you've gotten a character on the current line
currentLineIsBlank = false; } } }
delay(1); // give the web browser time to receive the data
client.stop(); // close the connection:
Serial.println("client disonnected"); }}
Ethernet: ejemplo cliente
ElCacharreo.com Arduino
Básico
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
char server[] = "www.google.com"; // name address for Google (using DNS)
IPAddress ip(192,168,0,177);
EthernetClient client;
void setup() {
Serial.begin(9600); while (!Serial) { ; // wait for serial port to connect. Needed for Leonardo only }
if (Ethernet.begin(mac) == 0) { Serial.println("Failed to configure Ethernet using DHCP");
Ethernet.begin(mac, ip); }
delay(1000); Serial.println("connecting..."); // give the Ethernet shield a second to initialize:
// if you get a connection, report back via serial:
if (client.connect(server, 80)) { Serial.println("connected"); // Make a HTTP request:
client.println("GET /search?q=arduino HTTP/1.1"); client.println("Host: www.google.com"); client.println
("Connection: close"); client.println(); }
else { Serial.println("connection failed"); // kf you didn't get a connection to the server:}}
void loop()
{
if (client.available()) {
char c = client.read();
Serial.print(c);
}
if (!client.connected()) { Serial.println(); Serial.println("disconnecting."); client.stop();
while(true); }}
Shield: ENC28J60
enc28J60
Librería ethercard (by JeeLab)
https://github.com/jcw/ethercard/archive/master.zip
Diferencias:
Precio
Rendimiento
Librerías más potente
ElCacharreo.com Arduino
Básico
Shield: ENC28J60, ejemplo cliente
#include <EtherCard.h>
static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 }; byte Ethernet::buffer[700]; static uint32_t timer;
char website[] PROGMEM = "www.google.com";
static void my_callback (byte status, word off, word len) { // called when the client request is complete
Serial.println(">>>"); Ethernet::buffer[off+300] = 0; Serial.print((const char*) Ethernet::buffer + off); Serial.println("...");}
void setup () { Serial.begin(57600); Serial.println("n[webClient]");
if (ether.begin(sizeof Ethernet::buffer, mymac) == 0) Serial.println( "Failed to access Ethernet controller");
if (!ether.dhcpSetup()) Serial.println("DHCP failed");
ether.printIp("IP: ", ether.myip); ether.printIp("GW: ", ether.gwip); ether.printIp("DNS: ", ether.dnsip);
if (!ether.dnsLookup(website)) Serial.println("DNS failed");
ether.printIp("SRV: ", ether.hisip);}
void loop () {
ether.packetLoop(ether.packetReceive());
if (millis() > timer) { timer = millis() + 5000;
Serial.println(); Serial.print("<<< REQ ");
ether.browseUrl(PSTR("/foo/"), "bar", website, my_callback); }}
ElCacharreo.com Arduino
Básico
Conclusiones
Gracias por vuestra atención
ElCacharreo.com Arduino
Básico

More Related Content

What's hot

Socket programming with php
Socket programming with phpSocket programming with php
Socket programming with php
Elizabeth Smith
 
Docker Networking
Docker NetworkingDocker Networking
Docker Networking
Weaveworks
 
Weave Networking on Docker
Weave Networking on DockerWeave Networking on Docker
Weave Networking on Docker
Stylight
 
Docker-OVS
Docker-OVSDocker-OVS
Docker-OVS
snrism
 
Linux Network commands
Linux Network commandsLinux Network commands
Linux Network commands
Hanan Nmr
 
Your app lives on the network - networking for web developers
Your app lives on the network - networking for web developersYour app lives on the network - networking for web developers
Your app lives on the network - networking for web developers
Wim Godden
 
Rasperry pi Part 12
Rasperry pi Part 12Rasperry pi Part 12
Rasperry pi Part 12
Techvilla
 
Linux networking
Linux networkingLinux networking
Linux networking
Arie Bregman
 
Dockerffm meetup 20150113_networking
Dockerffm meetup 20150113_networkingDockerffm meetup 20150113_networking
Dockerffm meetup 20150113_networking
Andreas Schmidt
 
TRENDnet IP Camera Multiple Vulnerabilities
TRENDnet IP Camera Multiple VulnerabilitiesTRENDnet IP Camera Multiple Vulnerabilities
TRENDnet IP Camera Multiple Vulnerabilities
insight-labs
 
NGiNX, VHOSTS & SSL (let's encrypt)
NGiNX, VHOSTS & SSL (let's encrypt)NGiNX, VHOSTS & SSL (let's encrypt)
NGiNX, VHOSTS & SSL (let's encrypt)
Marcel Cattaneo
 
Squid Server
Squid ServerSquid Server
Squid Server
Sumant Garg
 
Building interactivity with websockets
Building interactivity with websocketsBuilding interactivity with websockets
Building interactivity with websockets
Wim Godden
 
Netmiko library
Netmiko libraryNetmiko library
Netmiko library
Manjunath annure
 
OpenSSH: keep your secrets safe
OpenSSH: keep your secrets safeOpenSSH: keep your secrets safe
OpenSSH: keep your secrets safe
Giovanni Bechis
 
securing_syslog_onFreeBSD
securing_syslog_onFreeBSDsecuring_syslog_onFreeBSD
securing_syslog_onFreeBSD
webuploader
 
PHP Project development with Vagrant
PHP Project development with VagrantPHP Project development with Vagrant
PHP Project development with Vagrant
Bahattin Çiniç
 
Puppet User Group Presentation - 15 March 2012
Puppet User Group Presentation - 15 March 2012Puppet User Group Presentation - 15 March 2012
Puppet User Group Presentation - 15 March 2012
Walter Heck
 
Nginx
NginxNginx

What's hot (19)

Socket programming with php
Socket programming with phpSocket programming with php
Socket programming with php
 
Docker Networking
Docker NetworkingDocker Networking
Docker Networking
 
Weave Networking on Docker
Weave Networking on DockerWeave Networking on Docker
Weave Networking on Docker
 
Docker-OVS
Docker-OVSDocker-OVS
Docker-OVS
 
Linux Network commands
Linux Network commandsLinux Network commands
Linux Network commands
 
Your app lives on the network - networking for web developers
Your app lives on the network - networking for web developersYour app lives on the network - networking for web developers
Your app lives on the network - networking for web developers
 
Rasperry pi Part 12
Rasperry pi Part 12Rasperry pi Part 12
Rasperry pi Part 12
 
Linux networking
Linux networkingLinux networking
Linux networking
 
Dockerffm meetup 20150113_networking
Dockerffm meetup 20150113_networkingDockerffm meetup 20150113_networking
Dockerffm meetup 20150113_networking
 
TRENDnet IP Camera Multiple Vulnerabilities
TRENDnet IP Camera Multiple VulnerabilitiesTRENDnet IP Camera Multiple Vulnerabilities
TRENDnet IP Camera Multiple Vulnerabilities
 
NGiNX, VHOSTS & SSL (let's encrypt)
NGiNX, VHOSTS & SSL (let's encrypt)NGiNX, VHOSTS & SSL (let's encrypt)
NGiNX, VHOSTS & SSL (let's encrypt)
 
Squid Server
Squid ServerSquid Server
Squid Server
 
Building interactivity with websockets
Building interactivity with websocketsBuilding interactivity with websockets
Building interactivity with websockets
 
Netmiko library
Netmiko libraryNetmiko library
Netmiko library
 
OpenSSH: keep your secrets safe
OpenSSH: keep your secrets safeOpenSSH: keep your secrets safe
OpenSSH: keep your secrets safe
 
securing_syslog_onFreeBSD
securing_syslog_onFreeBSDsecuring_syslog_onFreeBSD
securing_syslog_onFreeBSD
 
PHP Project development with Vagrant
PHP Project development with VagrantPHP Project development with Vagrant
PHP Project development with Vagrant
 
Puppet User Group Presentation - 15 March 2012
Puppet User Group Presentation - 15 March 2012Puppet User Group Presentation - 15 March 2012
Puppet User Group Presentation - 15 March 2012
 
Nginx
NginxNginx
Nginx
 

Similar to Arduino práctico ethernet

Ethernet Shield
Ethernet ShieldEthernet Shield
Ethernet Shield
Tinker London
 
Networking and Data Access with Eqela
Networking and Data Access with EqelaNetworking and Data Access with Eqela
Networking and Data Access with Eqela
jobandesther
 
Pemrograman Jaringan
Pemrograman JaringanPemrograman Jaringan
Pemrograman Jaringan
belajarkomputer
 
Basic socket programming
Basic socket programmingBasic socket programming
Basic socket programming
Kristian Arjianto
 
Arduino、Web 到 IoT
Arduino、Web 到 IoTArduino、Web 到 IoT
Arduino、Web 到 IoT
Justin Lin
 
Unit 8 Java
Unit 8 JavaUnit 8 Java
Unit 8 Java
arnold 7490
 
03 sockets
03 sockets03 sockets
03 sockets
Pavan Illa
 
Advance Java-Network Programming
Advance Java-Network ProgrammingAdvance Java-Network Programming
Advance Java-Network Programming
ashok hirpara
 
Network programming in java - PPT
Network programming in java - PPTNetwork programming in java - PPT
Network programming in java - PPT
kamal kotecha
 
123
123123
Socket Programming it-slideshares.blogspot.com
Socket  Programming it-slideshares.blogspot.comSocket  Programming it-slideshares.blogspot.com
Socket Programming it-slideshares.blogspot.com
phanleson
 
Sockets intro
Sockets introSockets intro
Sockets intro
AviNash ChaVhan
 
Network security Lab manual
Network security Lab manual Network security Lab manual
Network security Lab manual
Vivek Kumar Sinha
 
Socket programming
Socket programming Socket programming
Socket programming
Rajivarnan (Rajiv)
 
Socket Programming - nitish nagar
Socket Programming - nitish nagarSocket Programming - nitish nagar
Socket Programming - nitish nagar
Nitish Nagar
 
Application Layer and Socket Programming
Application Layer and Socket ProgrammingApplication Layer and Socket Programming
Application Layer and Socket Programming
elliando dias
 
A.java
A.javaA.java
Lab manual cn-2012-13
Lab manual cn-2012-13Lab manual cn-2012-13
Lab manual cn-2012-13
Sasi Kala
 
INTRODUCTION TO SOCKETS IN COMPUTER NETWORKS DEPT OF CSE.ppt
INTRODUCTION TO SOCKETS IN COMPUTER NETWORKS DEPT OF CSE.pptINTRODUCTION TO SOCKETS IN COMPUTER NETWORKS DEPT OF CSE.ppt
INTRODUCTION TO SOCKETS IN COMPUTER NETWORKS DEPT OF CSE.ppt
senthilnathans25
 
Network Prog.ppt
Network Prog.pptNetwork Prog.ppt
Network Prog.ppt
EloOgardo
 

Similar to Arduino práctico ethernet (20)

Ethernet Shield
Ethernet ShieldEthernet Shield
Ethernet Shield
 
Networking and Data Access with Eqela
Networking and Data Access with EqelaNetworking and Data Access with Eqela
Networking and Data Access with Eqela
 
Pemrograman Jaringan
Pemrograman JaringanPemrograman Jaringan
Pemrograman Jaringan
 
Basic socket programming
Basic socket programmingBasic socket programming
Basic socket programming
 
Arduino、Web 到 IoT
Arduino、Web 到 IoTArduino、Web 到 IoT
Arduino、Web 到 IoT
 
Unit 8 Java
Unit 8 JavaUnit 8 Java
Unit 8 Java
 
03 sockets
03 sockets03 sockets
03 sockets
 
Advance Java-Network Programming
Advance Java-Network ProgrammingAdvance Java-Network Programming
Advance Java-Network Programming
 
Network programming in java - PPT
Network programming in java - PPTNetwork programming in java - PPT
Network programming in java - PPT
 
123
123123
123
 
Socket Programming it-slideshares.blogspot.com
Socket  Programming it-slideshares.blogspot.comSocket  Programming it-slideshares.blogspot.com
Socket Programming it-slideshares.blogspot.com
 
Sockets intro
Sockets introSockets intro
Sockets intro
 
Network security Lab manual
Network security Lab manual Network security Lab manual
Network security Lab manual
 
Socket programming
Socket programming Socket programming
Socket programming
 
Socket Programming - nitish nagar
Socket Programming - nitish nagarSocket Programming - nitish nagar
Socket Programming - nitish nagar
 
Application Layer and Socket Programming
Application Layer and Socket ProgrammingApplication Layer and Socket Programming
Application Layer and Socket Programming
 
A.java
A.javaA.java
A.java
 
Lab manual cn-2012-13
Lab manual cn-2012-13Lab manual cn-2012-13
Lab manual cn-2012-13
 
INTRODUCTION TO SOCKETS IN COMPUTER NETWORKS DEPT OF CSE.ppt
INTRODUCTION TO SOCKETS IN COMPUTER NETWORKS DEPT OF CSE.pptINTRODUCTION TO SOCKETS IN COMPUTER NETWORKS DEPT OF CSE.ppt
INTRODUCTION TO SOCKETS IN COMPUTER NETWORKS DEPT OF CSE.ppt
 
Network Prog.ppt
Network Prog.pptNetwork Prog.ppt
Network Prog.ppt
 

More from Jose Antonio Vacas

No mas semáforos javacasm
No mas semáforos   javacasmNo mas semáforos   javacasm
No mas semáforos javacasm
Jose Antonio Vacas
 
1.4 open hardware
1.4   open hardware1.4   open hardware
1.4 open hardware
Jose Antonio Vacas
 
Curso arduino basico bitbloq
Curso arduino basico bitbloqCurso arduino basico bitbloq
Curso arduino basico bitbloq
Jose Antonio Vacas
 
Robotica Educativa CEP Granada 2015
Robotica Educativa CEP Granada 2015Robotica Educativa CEP Granada 2015
Robotica Educativa CEP Granada 2015
Jose Antonio Vacas
 
Construcción de brazo robot
Construcción de brazo robotConstrucción de brazo robot
Construcción de brazo robot
Jose Antonio Vacas
 
Robotica educativa ii
Robotica educativa iiRobotica educativa ii
Robotica educativa ii
Jose Antonio Vacas
 
Robótica educativa swipe
Robótica educativa   swipeRobótica educativa   swipe
Robótica educativa swipe
Jose Antonio Vacas
 
1. inteligencia artificial y robótica
1. inteligencia artificial y robótica1. inteligencia artificial y robótica
1. inteligencia artificial y robótica
Jose Antonio Vacas
 
2. inteligencia artificial - Tareas
2. inteligencia artificial - Tareas2. inteligencia artificial - Tareas
2. inteligencia artificial - Tareas
Jose Antonio Vacas
 
3. inteligencia artificial ramas
3. inteligencia artificial   ramas3. inteligencia artificial   ramas
3. inteligencia artificial ramas
Jose Antonio Vacas
 
2.1 android cep jaen 2014 estructura de aplicación
2.1 android cep jaen 2014   estructura de aplicación2.1 android cep jaen 2014   estructura de aplicación
2.1 android cep jaen 2014 estructura de aplicación
Jose Antonio Vacas
 
1.1 android cep jaen 2015 introducción
1.1 android cep jaen 2015   introducción1.1 android cep jaen 2015   introducción
1.1 android cep jaen 2015 introducción
Jose Antonio Vacas
 
1.2 android cep jaen 2015 instalación del entorno
1.2 android  cep jaen 2015   instalación del entorno1.2 android  cep jaen 2015   instalación del entorno
1.2 android cep jaen 2015 instalación del entorno
Jose Antonio Vacas
 
1.3 android cep jaen 2015 plantillas y estructura de aplicación
1.3 android cep jaen 2015   plantillas y estructura de aplicación1.3 android cep jaen 2015   plantillas y estructura de aplicación
1.3 android cep jaen 2015 plantillas y estructura de aplicación
Jose Antonio Vacas
 
1.4 android cep jaen 2015 emulador
1.4 android cep jaen 2015   emulador1.4 android cep jaen 2015   emulador
1.4 android cep jaen 2015 emulador
Jose Antonio Vacas
 
Arduino práctico librerias
Arduino práctico   libreriasArduino práctico   librerias
Arduino práctico librerias
Jose Antonio Vacas
 
Arduino práctico introducción a la electrónica
Arduino práctico   introducción a la electrónicaArduino práctico   introducción a la electrónica
Arduino práctico introducción a la electrónica
Jose Antonio Vacas
 
Arduino práctico comunicaciones - serie
Arduino práctico   comunicaciones - serieArduino práctico   comunicaciones - serie
Arduino práctico comunicaciones - serie
Jose Antonio Vacas
 
Arduino práctico comunicaciones
Arduino práctico   comunicacionesArduino práctico   comunicaciones
Arduino práctico comunicaciones
Jose Antonio Vacas
 
Arduino práctico servos
Arduino práctico   servosArduino práctico   servos
Arduino práctico servos
Jose Antonio Vacas
 

More from Jose Antonio Vacas (20)

No mas semáforos javacasm
No mas semáforos   javacasmNo mas semáforos   javacasm
No mas semáforos javacasm
 
1.4 open hardware
1.4   open hardware1.4   open hardware
1.4 open hardware
 
Curso arduino basico bitbloq
Curso arduino basico bitbloqCurso arduino basico bitbloq
Curso arduino basico bitbloq
 
Robotica Educativa CEP Granada 2015
Robotica Educativa CEP Granada 2015Robotica Educativa CEP Granada 2015
Robotica Educativa CEP Granada 2015
 
Construcción de brazo robot
Construcción de brazo robotConstrucción de brazo robot
Construcción de brazo robot
 
Robotica educativa ii
Robotica educativa iiRobotica educativa ii
Robotica educativa ii
 
Robótica educativa swipe
Robótica educativa   swipeRobótica educativa   swipe
Robótica educativa swipe
 
1. inteligencia artificial y robótica
1. inteligencia artificial y robótica1. inteligencia artificial y robótica
1. inteligencia artificial y robótica
 
2. inteligencia artificial - Tareas
2. inteligencia artificial - Tareas2. inteligencia artificial - Tareas
2. inteligencia artificial - Tareas
 
3. inteligencia artificial ramas
3. inteligencia artificial   ramas3. inteligencia artificial   ramas
3. inteligencia artificial ramas
 
2.1 android cep jaen 2014 estructura de aplicación
2.1 android cep jaen 2014   estructura de aplicación2.1 android cep jaen 2014   estructura de aplicación
2.1 android cep jaen 2014 estructura de aplicación
 
1.1 android cep jaen 2015 introducción
1.1 android cep jaen 2015   introducción1.1 android cep jaen 2015   introducción
1.1 android cep jaen 2015 introducción
 
1.2 android cep jaen 2015 instalación del entorno
1.2 android  cep jaen 2015   instalación del entorno1.2 android  cep jaen 2015   instalación del entorno
1.2 android cep jaen 2015 instalación del entorno
 
1.3 android cep jaen 2015 plantillas y estructura de aplicación
1.3 android cep jaen 2015   plantillas y estructura de aplicación1.3 android cep jaen 2015   plantillas y estructura de aplicación
1.3 android cep jaen 2015 plantillas y estructura de aplicación
 
1.4 android cep jaen 2015 emulador
1.4 android cep jaen 2015   emulador1.4 android cep jaen 2015   emulador
1.4 android cep jaen 2015 emulador
 
Arduino práctico librerias
Arduino práctico   libreriasArduino práctico   librerias
Arduino práctico librerias
 
Arduino práctico introducción a la electrónica
Arduino práctico   introducción a la electrónicaArduino práctico   introducción a la electrónica
Arduino práctico introducción a la electrónica
 
Arduino práctico comunicaciones - serie
Arduino práctico   comunicaciones - serieArduino práctico   comunicaciones - serie
Arduino práctico comunicaciones - serie
 
Arduino práctico comunicaciones
Arduino práctico   comunicacionesArduino práctico   comunicaciones
Arduino práctico comunicaciones
 
Arduino práctico servos
Arduino práctico   servosArduino práctico   servos
Arduino práctico servos
 

Recently uploaded

Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
saastr
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
Antonios Katsarakis
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
Safe Software
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
Jason Packer
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
Neo4j
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Chart Kalyan
 
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
Alex Pruden
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
Edge AI and Vision Alliance
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
DianaGray10
 
The Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptxThe Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptx
operationspcvita
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Tosin Akinosho
 
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Pitangent Analytics & Technology Solutions Pvt. Ltd
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Precisely
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 

Recently uploaded (20)

Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
 
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
 
The Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptxThe Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptx
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
 
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 

Arduino práctico ethernet

  • 3. Arduino Básico: Presente ElCacharreo.com Arduino Básico javacasm@elcacharreo.com twitter linkedin blog José Antonio Vacas Martínez
  • 4. Arduino Básico: Ethernet ElCacharreo.com Arduino Básico Puede utilizarse tanto como cliente como servidor, es decir enviado o recibiendo datos Soporta hasta 4 conexiones simultáneas http://www.instructables. com/id/Arduino-Ethernet-Shield- Tutorial/?ALLSTEPS
  • 5. Arduino Básico: Ethernet server ElCacharreo.com Arduino Básico #include <Ethernet.h> byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; byte ip[] = { 10, 0, 0, 177 }; //the IP address for the shield: byte gateway[] = { 10, 0, 0, 1 };// the router's gateway address: byte subnet[] = { 255, 255, 0, 0 };// the subnet: Server server = Server(23); void setup(){ // initialize the ethernet device Ethernet.begin(mac, ip, gateway, subnet); // start listening for clients server.begin();} void loop(){ // if an incoming client connects, there will be bytes available to read: Client client = server.available(); if (client == true) { // read bytes from the incoming client and write them back // to any clients connected to the server: server.write(client.read()); } }
  • 6. Ejemplos Ethernet: webserver ElCacharreo.com Arduino Básico void loop() { // listen for incoming clients EthernetClient client = server.available(); if (client) { Serial.println("new client"); boolean currentLineIsBlank = true; // an http request ends with a blank line while (client.connected()) { if (client.available()) { char c = client.read(); Serial.write(c); if (c == 'n' && currentLineIsBlank) { // send a standard http response header client.println("HTTP/1.1 200 OK"); client.println("Content-Type: text/html"); client.println("Connection: close"); client.println(); client.println("<!DOCTYPE HTML>"); client.println("<html>"); // add a meta refresh tag, so the browser pulls again every 5 seconds: client.println("<meta http-equiv="refresh" content="5">"); // output the value of each analog input pin for (int analogChannel = 0; analogChannel < 6; analogChannel++) { int sensorReading = analogRead(analogChannel); client.print("analog input "); client.print(analogChannel); client.print(" is "); client.print(sensorReading); client.println("<br />"); } client.println("</html>"); break; } if (c == 'n') { // you're starting a new line currentLineIsBlank = true; } else if (c != 'r') { // you've gotten a character on the current line currentLineIsBlank = false; } } } delay(1); // give the web browser time to receive the data client.stop(); // close the connection: Serial.println("client disonnected"); }}
  • 7. Ethernet: ejemplo cliente ElCacharreo.com Arduino Básico #include <SPI.h> #include <Ethernet.h> byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; char server[] = "www.google.com"; // name address for Google (using DNS) IPAddress ip(192,168,0,177); EthernetClient client; void setup() { Serial.begin(9600); while (!Serial) { ; // wait for serial port to connect. Needed for Leonardo only } if (Ethernet.begin(mac) == 0) { Serial.println("Failed to configure Ethernet using DHCP"); Ethernet.begin(mac, ip); } delay(1000); Serial.println("connecting..."); // give the Ethernet shield a second to initialize: // if you get a connection, report back via serial: if (client.connect(server, 80)) { Serial.println("connected"); // Make a HTTP request: client.println("GET /search?q=arduino HTTP/1.1"); client.println("Host: www.google.com"); client.println ("Connection: close"); client.println(); } else { Serial.println("connection failed"); // kf you didn't get a connection to the server:}} void loop() { if (client.available()) { char c = client.read(); Serial.print(c); } if (!client.connected()) { Serial.println(); Serial.println("disconnecting."); client.stop(); while(true); }}
  • 8. Shield: ENC28J60 enc28J60 Librería ethercard (by JeeLab) https://github.com/jcw/ethercard/archive/master.zip Diferencias: Precio Rendimiento Librerías más potente ElCacharreo.com Arduino Básico
  • 9. Shield: ENC28J60, ejemplo cliente #include <EtherCard.h> static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 }; byte Ethernet::buffer[700]; static uint32_t timer; char website[] PROGMEM = "www.google.com"; static void my_callback (byte status, word off, word len) { // called when the client request is complete Serial.println(">>>"); Ethernet::buffer[off+300] = 0; Serial.print((const char*) Ethernet::buffer + off); Serial.println("...");} void setup () { Serial.begin(57600); Serial.println("n[webClient]"); if (ether.begin(sizeof Ethernet::buffer, mymac) == 0) Serial.println( "Failed to access Ethernet controller"); if (!ether.dhcpSetup()) Serial.println("DHCP failed"); ether.printIp("IP: ", ether.myip); ether.printIp("GW: ", ether.gwip); ether.printIp("DNS: ", ether.dnsip); if (!ether.dnsLookup(website)) Serial.println("DNS failed"); ether.printIp("SRV: ", ether.hisip);} void loop () { ether.packetLoop(ether.packetReceive()); if (millis() > timer) { timer = millis() + 5000; Serial.println(); Serial.print("<<< REQ "); ether.browseUrl(PSTR("/foo/"), "bar", website, my_callback); }} ElCacharreo.com Arduino Básico
  • 10. Conclusiones Gracias por vuestra atención ElCacharreo.com Arduino Básico