| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

4 ELABORATION of The LilyPad Part 2

Page history last edited by Stephanie 11 years, 3 months ago

Now We Know How the LilyPad Projects are Put Together, Let's ELABORATE on How We Program Them!

 

Let's take a look at the explanation of programming!

 

Example of Coding for Flower Frame:  Example of Coding for Winter Door Sign: 

void setup() {                

 

pinMode(12, OUTPUT); //sets pin 12 as output

pinMode(13,OUTPUT); //sets pin 13 as output

pinMode(2, OUTPUT); //sets pin 2 as output

pinMode(3,OUTPUT); //sets pin 3 as output

pinMode(10, OUTPUT); //sets pin 10 as output

pinMode(9,OUTPUT); //sets pin 9 as output

pinMode(8, OUTPUT); //sets pin 8 as output

pinMode(7,OUTPUT); //sets pin 7 as output

digitalWrite(3, LOW); //sets pin 3 as ground for pin 2

digitalWrite(7,LOW); //sets pin 7 as ground for pin 8

digitalWrite(9,LOW); //sets pin 9 as ground for pin 10

digitalWrite(13,LOW); //sets pin 13 as ground for pin 12

}

 

void loop() 

{

  digitalWrite(2, HIGH);    // turns pin 2 on - rain

  delay(1000);              // wait for a second

  digitalWrite(2, LOW);    // turn pin 2 off

  delay(1000);              // wait for a second

  digitalWrite(2, HIGH);  // turns pin 2 on - rain

  delay(1000);         // wait for a second

  digitalWrite(2, LOW);    // turn pin 2 off

  delay(1000);              // wait for a second

  digitalWrite(2, HIGH);    // turns pin 2 on - rain

  delay(1000);              // wait for a second

  digitalWrite(2, LOW);    // turn pin 2 off

  digitalWrite (12, HIGH); //turns pin 12 on - sun

  delay(3000); //wait for 3 seconds

  digitalWrite (8,HIGH); //turns pin 8 on - stem

  delay (2000); //wait for 2 second

  digitalWrite (12, LOW); //turns pin 12 off - sun

  digitalWrite(2, HIGH);    // turns pin 2 on - rain

  delay(1000);              // wait for a second

  digitalWrite(2, LOW);    // turn pin 2 off

  delay(1000);              // wait for a second

  digitalWrite(2, HIGH);  // turns pin 2 on - rain

  delay(1000);         // wait for a second

  digitalWrite(2, LOW);    // turn pin 2 off

  delay(1000);              // wait for a second

  digitalWrite(2, HIGH);    // turns pin 2 on - rain

  delay(1000);              // wait for a second

  digitalWrite(2, LOW);    // turn pin 2 off

  digitalWrite(12, HIGH); //turns sun on

  delay (2000); //delays 2 seconds

  digitalWrite (10, HIGH); //turns pin 12 on - flower 

  delay (4000); //waits for 4 seconds

  digitalWrite (12, LOW);  //turns pin 12 off - sun

  digitalWrite (10, LOW); //turns pin 10 off - flower

  digitalWrite (8,LOW); //turns pin 8 off - stem

}

 

void setup() {

  // put your setup code here, to run once:

pinMode (13, OUTPUT);

pinMode (12, OUTPUT);

pinMode (11, OUTPUT);

pinMode (10, OUTPUT);

pinMode (2, OUTPUT);

pinMode (3, OUTPUT);

digitalWrite(12, LOW);

digitalWrite(10, LOW);

digitalWrite(2, LOW);

}

 

void loop() {

  // put your main code here, to run repeatedly: 

digitalWrite(13, HIGH);

digitalWrite(11, HIGH);

digitalWrite(2, HIGH);

digitalWrite(3, HIGH);

digitalWrite(5, HIGH);

digitalWrite(12, LOW);

digitalWrite(10, LOW);

digitalWrite(2, LOW);

delay(1500);

digitalWrite(13, LOW);

delay(1500);

}

 

 

 

Let's see how to upload it using the  Arduino software!

Comments (0)

You don't have permission to comment on this page.