Up: Ejercicio-2 Semáforo con sensores Previous: Ejercicio-2 Semáforo con sensores


Solución-2


 		 
 

/*********************************************************************
/*
/*  Traffic Light (Semaforo)
/*  This program shows how to set the HIGH bit or the LOW bit
/*  (on and off) at every PIN.
/*
/*  juanig_at_ccrma.stanford
/*
/*  November 13,2006
/*********************************************************************/



int redPin = 0, yellowPin=1, greenPin=2;        

void setup()
{
  pinMode(redPin, OUTPUT); 
  pinMode(yellowPin, OUTPUT);
  pinMode(greenPin, OUTPUT);
}

void loop()
{
  digitalWrite(greenPin, HIGH);   // sets the LED on
  delay(10000);                     // waits a bit
  digitalWrite(greenPin, LOW);    //sets the LED off
  //
  digitalWrite(yellowPin, HIGH);    
  delay(1000);
  digitalWrite(yellowPin, LOW);
  //
  digitalWrite(redPin, HIGH);    
  delay(5000);
  digitalWrite(redPin, LOW);
  //
}


next up previous
Up: Ejercicio-2 Semáforo con sensores Previous: Ejercicio-2 Semáforo con sensores

© Copyright 2001-2008 CCRMA, Stanford University. All rights reserved.
Created and Mantained by Juan Reyes