\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{perla} \pdfinfo{ /Title (arduino.pdf) /Creator (Cheatography) /Author (perla) /Subject (arduino Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{A06FA3} \definecolor{LightBackground}{HTML}{F9F6F9} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{arduino Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{perla} via \textcolor{DarkBackground}{\uline{cheatography.com/122876/cs/23002/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}perla \\ \uline{cheatography.com/perla} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 26th May, 2020.\\ Updated 26th May, 2020.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{4} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Sensores}} \tn \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Un sensor es todo aquello que tiene una propiedad sensible a una magnitud del medio, y al variar la magnitud también varía con cierta intensidad la propiedad, manifiesta la presencia de dicha magnitud, y su medida también.% Row Count 5 (+ 5) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Sensores de Temperatura (LMR35)}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{float leerGradosC()\{ \newline int d; \newline float c; \newline //se leen los datos analógicos del sensor \newline d=analogRead(A0); \newline //convertimos el dato de entrada a grados celsious \newline c= (400.0*d/1024) \newline return c; \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Sensor Ultrasónico HC-SR04}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{const int Trigger = 2; //Pin digital 2 para el Trigger del sensor \newline const int Echo = 3; //Pin digital 3 para el echo del sensor \newline \newline void setup() \{ \newline \seqsplit{Serial.begin(9600);//iniciaiLIamos} la comunicación \newline pinMode(Trigger, OUTPUT); //pin como salida \newline pinMode(Echo, INPUT); //pin como entrada \newline digitalWrite(Trigger, LOW);//Inicializamos el pin con 0 \newline \} \newline \newline void loop() \newline \{ \newline \newline long t; //timepo que demora en llegar el eco \newline long d; //distancia en centimetros \newline \newline digitalWrite(Trigger, HIGH); \newline delayMicroseconds(10); //Enviamos un pulso de 10us \newline digitalWrite(Trigger, LOW); \newline \newline t = pulseIn(Echo, HIGH); //obtenemos el ancho del pulso \newline d = t/59; //escalamos el tiempo a una distancia en cm \newline \newline Serial.print("Distancia: "); \newline Serial.print(d); //Enviamos serialmente el valor de la distancia \newline Serial.print("cm"); \newline Serial.println(); \newline delay(100); //Hacemos una pausa de 100ms \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Sensor IR LM393 (detector de obstáculos)}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{const int sensorPin = 9; \newline \newline void setup() \{ \newline Serial.begin(9600); //iniciar puerto serie \newline pinMode(sensorPin , INPUT); //definir pin como entrada \newline \} \newline \newline void loop()\{ \newline int value = 0; \newline value = digitalRead(sensorPin ); //lectura digital de pin \newline \newline if (value == HIGH) \{ \newline \seqsplit{Serial.println("Detectado} obstaculo"); \newline \} \newline delay(1000); \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Sensor de Humedad FC-28}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{onst int sensorPin = 10; \newline \newline void setup() \newline \{ \newline Serial.begin(9600); \newline pinMode(sensorPin, INPUT); \newline \} \newline \newline void loop() \newline \{ \newline int humedad = digitalRead(sensorPin); \newline \newline //mandar mensaje a puerto serie en función del valor leido \newline if (humedad == HIGH) \newline \{ \newline \seqsplit{Serial.println("Encendido");} \newline //aquí se ejecutarían las acciones \newline \} \newline delay(1000); \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Fotoresistencia LDR}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{int valorl=0; \newline int pinL=A0; \newline \newline void setup() \newline \{ \newline Seral.begin(9600); \newline \} \newline \newline void loop() \newline \{ \newline valorL=analogRead(pinL); \newline Serial.println(valorL); \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Sensor de Movimiento PIR}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{const int LEDPin= 13; \newline const int PIRPin= 2; \newline \newline void setup() \newline \{ \newline pinMode(LEDPin, OUTPUT); \newline pinMode(PIRPin, INPUT); \newline \} \newline \newline void loop() \newline \{ \newline int value= digitalRead(PIRPin); \newline \newline if (value == HIGH) \newline \{ \newline digitalWrite(LEDPin, HIGH); \newline delay(50); \newline digitalWrite(LEDPin, LOW); \newline delay(50); \newline \} \newline else \newline \{ \newline digitalWrite(LEDPin, LOW); \newline \} \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Potenciómetro}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{//Variable donde almacenaremos el valor del potenciometro \newline long valor; \newline \newline void setup() \{ \newline //Inicializamos la comunicación serial \newline Serial.begin(9600); \newline \newline //Escribimos por el monitor serie mensaje de inicio \newline Serial.println("Inicio de sketch - valores del potenciometro"); \newline \newline \} \newline \newline void loop() \{ \newline // leemos del pin A0 valor \newline valor = analogRead(A0); \newline \newline //Imprimimos por el monitor serie \newline Serial.print("El valor es = "); \newline Serial.println(valor); \newline delay(1000); \newline \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Bluetooth}} \tn \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{El bluetooth es una especificación industrial para Redes Inalámbricas de Área Personal (WPAN) que posibilita la transmición de voz y datos entre diferentes dispositivos mediante un enlace por radiofrecuencia en la banda ISM de los 2,4 GHz.% Row Count 5 (+ 5) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Conexión Bluetooth}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{const int led= 13; \newline int opc; \newline \newline void setup()\{ \newline Serial.begin(9600); \newline pinMode(led,OUTPUT); \newline \} \newline \newline void loop()\{ \newline if(Serial.available()\textgreater{}0)\{ \newline //leer la opcion \newline char opc=Serial.read(); \newline \newline if(opc \textgreater{}= '1' \&\& opc\textless{}= '9') \newline opc= '0'; \newline for(int i=0;i\textless{}opc;i++) \newline \{ \newline digitalWrite(led,HIGH); \newline delay(100); \newline digitalWrite(led,LOW); \newline delay(200); \newline \} \newline \} \newline \} \newline \} \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{p{0.3433 cm} p{0.3433 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{3.833cm}}{\bf\textcolor{white}{Internet de las Cosas}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{3.833cm}}{} \tn % Row Count 0 (+ 0) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Internet de las Cosas}} \tn \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{El internet de las cosas es un concepto que se refiere a una interconexión digital de objetos cotidianos con internet.% Row Count 3 (+ 3) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Pasos para IoT en Arduino}} \tn \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{1. Conseguir una Ethernet shield compatible con arduino uno \newline % Row Count 2 (+ 2) 2. Crear una base de datos \newline % Row Count 3 (+ 1) 3. Programar un servidor \newline % Row Count 4 (+ 1) 4. Programar la tarjeta Arduino% Row Count 5 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Ejemplo IoT con sensor de temperatura}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{\#include \textless{}Ethernet.h\textgreater{} \newline \#include \textless{}SPI.h\textgreater{} \newline \newline byte mac{[} {]} =\{0XDE, 0XAD, 0XBE, 0XEF, 0XFF, 0XEE\}; //direcion mac \newline byte ip{[} {]} =\{ 192,168,1,100 \}; //direccion ip del arduino \newline byte server{[} {]}= \{ 192,168,1,6 \};//direccion ip del servidor \newline EthernetClient Client; \newline float temp; \newline int analog\_pin =0; \newline \newline void setup(void)\{ \newline Ethernet.begin(mac, ip); // inicializar el ethernet shield \newline delay(1000);//esperamos 1 seg \newline \} \newline \newline void loop(void) \{ \newline temp= analogRead(analog\_pin); \newline temp= 5.0temp100.0/1024.0; \newline Serial.print(temp); \newline Serial.println(" 0C"); \newline \seqsplit{Serial.println("Connecting...");} \newline if(client.connect(server, 80)\textgreater{}0) \{ \newline client.print("GET \seqsplit{/tutoiot/iot.php?valor=");//enviamos} los datos por GET \newline client.print(temp); \newline client.println( "HTTP/1.0"); \newline \seqsplit{client.println("USER-Agent:} Arduino 1.0"); \newline client.println(); \newline \seqsplit{Serial.println("conectado");} \newline \}else\{ \newline Serial.println("Fallo en la conexion"); \newline \} \newline if(!client.connected()) \{ \newline \seqsplit{Serial.println("Disconnected}!"); \newline \} \newline client.stop(); \newline client.flush(); \newline delay(60000);//esperar un min antes de tomar otra muestra \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Datos}} \tn \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Nombre: Haro Rodríguez Perla Beatriz \newline % Row Count 1 (+ 1) Matrícula: 1253616 \newline % Row Count 2 (+ 1) Fecha: 25 de Mayo del 2020% Row Count 3 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}