Hi Community ,
Ich habe es mitlerweile hinbekommen LED's übers web mit hilfe von WebIOPi zu steuern .
Ich möchte mit nem angeschlossenem taster (liegt auf pin 3) die led aber auch an oder aus machen können. Sprich wenn ich sie übers web anschalte und dann den taster drücke soll sie sich ausschalten und anders herum.
hir ist mein code :
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content = "height = device-height, width = 420, user-scalable = no" />
<title>WebIOPi | Demo</title>
<script type="text/javascript" src="/webiopi.js"></script>
<script type="text/javascript">
webiopi().ready(function() {
webiopi().setFunction(25,"out");
webiopi().setFunction(23,"out");
var content, button;
content = $("#content");
// create a "LED" labeled button for GPIO 25
button = webiopi().createGPIOButton(25, "LED 1");
content.append(button); // append button to content div
// create a "LED" labeled button for GPIO 25
button = webiopi().createGPIOButton(23, "LED 2");
content.append(button); // append button to content div
webiopi().refreshGPIO(true);
});
</script>
<style type="text/css">
button {
display: block;
margin: 5px 5px 5px 5px;
width: 160px;
height: 45px;
font-size: 24pt;
font-weight: bold;
color: black;
}
input[type="range"] {
display: block;
width: 160px;
height: 45px;
}
.LOW {
background-color: White;
}
.HIGH {
background-color: Red;
}
</style>
</head>
<body>
<div id="content" align="center"></div>
</body>
</html>
Alles anzeigen