<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>ej6</title>
<style type="text/css">
td {
	text-align: center;
}
</style>

<script >

function high(salida) { 
	var c;//c almacena el color del led
	
	if(salida<=3){c = "#ff0000";
		}else {
		c = "#00ff00";}
	setTimeout('document.getElementById(' + salida + ').style.background ="'+ c+ '"',tiempo);	
}
  		
 function low(salida) { 
 	setTimeout('document.getElementById(' + salida + ').style.background ="#FFFFFF"',tiempo);	
 
}

var tiempo = 0;

function pausa(milisegundos) {
	tiempo = tiempo + milisegundos;
}

;//almacena el tiempo que tarda p() en ejecutarse

function p() {//aquí debemos escribir el programa que se repite una sola vez
	var tInicio// almacena el momento de inicio de p

		
	
	

				
}

function bucle( numero, estado){//esta función se comporta como un bucle infinito sobre la función entrada()
	
	setInterval('entrada('+numero+','+estado+')',tiempo);

}

function reinicio() {

document.location.href = document.location.href;

}


var e6=false;
var e7=false;

function entrada(n) {
if (n==6) {e6=!e6;	
}

if (n==7) {e7=!e7;	
}

	if  (e6 ) {//código if pin6=1
	document.getElementById("pulsador6").style.background ="#ff0000";	//el pulsador rojo indica que está pulsado
	
		}else{//código if pin6=0
	document.getElementById("pulsador6").style.background ="#f2efeb";		//el pulsador blanco indica que  no está pulsado
	
	}

	if  (e7 ) {//código if pin7=1=
	document.getElementById("pulsador7").style.background ="#ff0000";	//el pulsador rojo indica que está pulsado
	}else{//código if pin7=0
	document.getElementById("pulsador7").style.background ="#f2efeb";	//el pulsador blanco indica que  no está pulsado
	}
	if (e6 && e7) {
	high(1);	
	}else {
		low(1);
	}

}





</script>
</head>
<body  >

<td bgcolor="#FF0000"></td>
<table cellpadding="2" cellspacing="2" border="1">
	<tr>
		<td id="7">7</td>
		<td id="6">6</td>
		<td id="5">5</td>
		<td id="4">4</td>
		<td id="3">3</td>
		<td id="2">2</td>
		<td id="1">1</td>
		<td id="0">0</td>
		
	</tr>
	
</table>
<br>
<input type="submit" value="entrada 6" onmousedown="entrada(6)" id="pulsador6"/>
<input type="submit" value="entrada 7" onmousedown='entrada(7)' id="pulsador7"/>
</body>
</html>