add camera pins
This commit is contained in:
parent
ee45d97a8b
commit
93b6260bf9
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
function take_photo() {
|
function take_photo() {
|
||||||
$.get("/photo/", function (data) {
|
$.get("/photo/", function (data) {
|
||||||
|
$("#photo").attr("src", "static/photo.jpg?"+d.getTime());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -45,7 +45,7 @@
|
||||||
<div class="jumbotron">
|
<div class="jumbotron">
|
||||||
<button class="btn btn-primary btn-lg btn-block" onclick="take_photo();">Take photo</button>
|
<button class="btn btn-primary btn-lg btn-block" onclick="take_photo();">Take photo</button>
|
||||||
<p></p>
|
<p></p>
|
||||||
<img src="{% static '1.jpg' %}" alt="My image">
|
<img id="photo" src="{% static 'photo.jpg' %}">
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="jumbotron">
|
<div class="jumbotron">
|
||||||
|
|
|
@ -26,7 +26,7 @@ def home(request):
|
||||||
|
|
||||||
|
|
||||||
def take_photo(request):
|
def take_photo(request):
|
||||||
print("PRINTING PHOTO")
|
capture_image("/tmp/static/photo.jpg")
|
||||||
return HttpResponse("Ok")
|
return HttpResponse("Ok")
|
||||||
|
|
||||||
|
|
||||||
|
@ -50,8 +50,8 @@ def turn_on_all():
|
||||||
def toggle_led(led, turn_on):
|
def toggle_led(led, turn_on):
|
||||||
gpio_pin = leds_gpio[led]
|
gpio_pin = leds_gpio[led]
|
||||||
if turn_on:
|
if turn_on:
|
||||||
pin_control.turn_on_pin(gpio_pin)
|
|
||||||
else:
|
|
||||||
pin_control.turn_off_pin(gpio_pin)
|
pin_control.turn_off_pin(gpio_pin)
|
||||||
|
else:
|
||||||
|
pin_control.turn_on_pin(gpio_pin)
|
||||||
leds_state[led] = not turn_on
|
leds_state[led] = not turn_on
|
||||||
return HttpResponse(f"Turn on {led}" if turn_on else f"Turn off {led}")
|
return HttpResponse(f"Turn on {led}" if turn_on else f"Turn off {led}")
|
Loading…
Reference in a new issue