Large diffs are not rendered by default.

Large diffs are not rendered by default.

Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -11,6 +11,7 @@
use PiPHP\GPIO\GPIO;
use PiPHP\GPIO\Pin\PinInterface;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;

class IndexController extends Controller
{
@@ -19,4 +20,16 @@ public function index()
// https://packagist.org/packages/piphp/gpio
return $this->render('index.html.twig');
}

public function trigger(Request $request)
{
$pinNumber = $request->get('pin');
$gpio = new GPIO();
$pin = $gpio->getOutputPin(intval($pinNumber));
if ($request->get('on') === 'true') {
$pin->setValue(PinInterface::VALUE_LOW);
} else {
$pin->setValue(PinInterface::VALUE_HIGH);
}
}
}

This file was deleted.

@@ -3,10 +3,17 @@
<head>
<meta charset="UTF-8">
<title>{% block title %}Welcome!{% endblock %}</title>
{% block stylesheets %}{% endblock %}
{% block stylesheets %}
<link rel="stylesheet" href="{{ asset('/jquery/jquery-ui.min.css') }}">
<link rel="stylesheet" href="{{ asset('/semantic/semantic.min.css') }}">
{% endblock %}
</head>
<body>
{% block body %}{% endblock %}
{% block javascripts %}{% endblock %}
{% block javascripts %}
<script src="{{ asset('/jquery/jquery-3.3.1.min.js') }}"></script>
<script src="{{ asset('/jquery/jquery-ui.min.js') }}"></script>
<script src="{{ asset('/semantic/semantic.min.js') }}"></script>
{% endblock %}
</body>
</html>
@@ -1,4 +1,53 @@
{% extends "base.html.twig" %}
{% block body %}
cocktails junge
{% endblock %}
<div class="ui container">
<div class="ui segment center">
<div class="ui form">
<div class="grouped fields">
<div class="field">
<div class="ui toggle checkbox">
<input type="checkbox" name="pin21" data-pin="21" class="pump-control">
<label>Pump 1</label>
</div>
</div>
<div class="field">
<div class="ui toggle checkbox">
<input type="checkbox" name="pin20" data-pin="20" class="pump-control">
<label>Pump 2</label>
</div>
</div>
<div class="field">
<div class="ui toggle checkbox">
<input type="checkbox" name="pin26" data-pin="26" class="pump-control">
<label>Pump 3</label>
</div>
</div>
<div class="field">
<div class="ui toggle checkbox">
<input type="checkbox" name="pin19" data-pin="19" class="pump-control">
<label>Pump 4</label>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}

{% block javascripts %}
{{ parent() }}
<script>
$(document).ready(() => {
$('.pump-control').on('click', (event) => {
let on = $(event.target).prop('checked');
let pin = $(event.target).data('pin');
$.ajax({
url: '/pump/send',
method: "POST",
data: {on: on, pin: pin}
});
})
})
</script>
{% endblock %}