Códigos Prácticas ARDUINO

Description
Códigos de programación para prácticas con Arduino

Please download to get full document.

View again

of 5
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Information
Category:

Documents

Publish on:

Views: 2 | Pages: 5

Extension: DOC | Download: 0

Share
Transcript
  Código ARDUINO  Práctica 1: BLINK- ENCENDER UN LED int led = 13;void set! # $!in%ode led& 'U(PU(#; ))*e con+i,ra el !in 13 coo salida .void loo! # $di,ital/rite led& 0I0#; )) *e enciende el leddela2 1#; )) *e es!era nos se,ndosdi,ital/rite led& L'/#; )) *e a!a,a el leddela2 1#; )) *e es!era nos se,ndos .  Práctica 4: *E%56'R'7 int ledR = 14;int led8 = 9;int led = ;void set! # $!in%ode ledR& 'U(PU(#;!in%ode led8& 'U(PU(#;!in%ode led& 'U(PU(#; .void loo! # $di,ital/rite ledR& 0I0#; )) *eá+oro en ro<odi,ital/rite led8& L'/#;di,ital/rite led& L'/#;dela2 1#;di,ital/rite ledR& L'/#; )) seá+oro en verdedi,ital/rite led8& L'/#;di,ital/rite led& 0I0#;dela2 1#;di,ital/rite ledR& L'/#;di,ital/rite led8& 0I0#;di,ital/rite led& L'/#; )) seá+oro en aarillodela2 1#;di,ital/rite ledR& L'/#; )) tie!o de es!era todo a!a,adodi,ital/rite led8& L'/#;di,ital/rite led& L'/#;dela2 1#; .     Práctica 3: ENCENDER LED C'N PUL*8D'R const int ttonPin = 4; )) t>e ner o+ t>e !s>tton !inconst int ledPin = 13; )) t>e ner o+ t>e LED !in )) variales ?ill c>an,e:int tton*tate = ; )) variale +or readin, t>e !s>tton statsvoid set! # $ )) initiali@e t>e LED !in as an ot!t:!in%ode ledPin& 'U(PU(#;  )) initiali@e t>e !s>tton !in as an in!t:!in%ode ttonPin& INPU(#;  .void loo! #$ )) read t>e state o+ t>e !s>tton vale:tton*tate = di,italRead ttonPin#; )) c>ecA i+ t>e !s>tton is !ressed7 )) i+ it is& t>e tton*tate is 0I0:i+ tton*tate == 0I0# $  )) trn LED on: di,ital/rite ledPin& 0I0#;  . else $ )) trn LED o++:di,ital/rite ledPin& L'/#;  . .   Práctica : C'N(R'L DE L8 IN(EN*ID8D LED C'N P'(ENCI%E(R'7 int sensorPin = 8; )) select t>e in!t !in +or t>e !otentioeterint ledPin = 9; )) select t>e !in +or t>e LED  int sensorale = ; )) variale to store t>e vale coin, +ro t>e sensorvoid set! # $ )) declare t>e ledPin as an 'U(PU(:!in%ode ledPin& 'U(PU(#;  .void loo! # $ )) read t>e vale +ro t>e sensor:sensorale = analo,Read sensorPin#;  )) trn t>e ledPin ondi,ital/rite ledPin& 0I0#;  )) sto! t>e !ro,ra +or sensorale illiseconds:dela2 sensorale#;  )) trn t>e ledPin o++: di,ital/rite ledPin& L'/#;  )) sto! t>e !ro,ra +or +or sensorale illiseconds:dela2 sensorale#;  .  Práctica F: C'N(R'L DE LUG C'N LDR int sensorPin = 8;int ledPin = H;int sensorale = ;void set! # $!in%ode ledPin& 'U(PU(#; .void loo! # $sensorale = analo,Read sensorPin#;i+ sensorale 4#$di,ital/rite ledPin& L'/#;.else$di,ital/rite ledPin& 0I0#;. .  Práctica : C'N(R'L DE UN *ER'%'('R7  inclde *ervo7>*ervo 2servo; )) create servo o<ect to control a servo  )) a aJi o+ ei,>t servo o<ects can e createdint !os = ; )) variale to store t>e servo !osition  void set! # $ 2servo7attac> 9#; )) attac>es t>e servo on !in 9 to t>e servo o<ect  .void loo! # $ +or !os = ; !os  1; !os = 1# )) ,oes +ro  de,rees to 1 de,rees $ )) in ste!s o+ 1 de,ree 2servo7?rite !os#; )) tell servo to ,o to !osition in variale M!os dela2 1F#; )) ?aits 1Fs +or t>e servo to reac> t>e !osition  . +or !os = 1; !os=1; !os-=1# )) ,oes +ro 1 de,rees to  de,rees $ 2servo7?rite !os#; )) tell servo to ,o to !osition in variale M!os dela2 1F#; )) ?aits 1Fs +or t>e servo to reac> t>e !osition  .  .  Práctica H: C'N(R'L DE UN %'('R7 int otorPin = 13;void set! # $ !in%ode otorPin& 'U(PU(#; ))*e con+i,ra el !in 13 coo salida .void loo! # $di,ital/rite otorPin& 0I0#; )) *e enciende el leddela2 1#; )) *e es!era nos se,ndosdi,ital/rite otorPin& L'/#; )) *e a!a,a el leddela2 1#; )) *e es!era nos se,ndos .  Práctica : *E%56'R' P8R8 INIDEN(E*7 int ledR = 1;int led8 = 9;int led = ;int @ador = ;
Related Search
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks