From 54e28093b9c54d2a8ded55c26dab2ada13c07c25 Mon Sep 17 00:00:00 2001 From: tpollina Date: Tue, 10 Dec 2019 22:29:42 -0800 Subject: [PATCH] Add files via upload --- pipeline/focus.php | 2 +- pipeline/newfile.txt | 1 + pipeline/pipeline.js | 40 +++++++++++++++++++++++++++------------- pipeline/pump.php | 2 +- pipeline/pump.py | 2 +- pipeline/write.php | 6 ++++++ 6 files changed, 37 insertions(+), 16 deletions(-) create mode 100644 pipeline/newfile.txt create mode 100644 pipeline/write.php diff --git a/pipeline/focus.php b/pipeline/focus.php index 70d768a..2bc5b17 100644 --- a/pipeline/focus.php +++ b/pipeline/focus.php @@ -4,5 +4,5 @@ $orientation = $_REQUEST["orientation"]; $toggler = $_REQUEST["toggler"]; -$output = shell_exec('/usr/bin/python3 focus.py '.$nb_step.' '.$orientation.' '.$toggler); +$output = shell_exec('/usr/bin/python3 /var/www/html/pipeline/focus.py '.$nb_step.' '.$orientation.' '.$toggler); ?> diff --git a/pipeline/newfile.txt b/pipeline/newfile.txt new file mode 100644 index 0000000..8f0c5ea --- /dev/null +++ b/pipeline/newfile.txt @@ -0,0 +1 @@ +ceciestuntexte \ No newline at end of file diff --git a/pipeline/pipeline.js b/pipeline/pipeline.js index d880a15..2e254e1 100644 --- a/pipeline/pipeline.js +++ b/pipeline/pipeline.js @@ -9,23 +9,37 @@ $(document).ready(function(){ pump() }); + $( "#write" ).click(function() { + write() + + }); + -function focus(toggler) { - var value = $("#nb_step").val(); - var orientation = $("#orientation").val(); - var xmlhttp = new XMLHttpRequest(); - xmlhttp.open("GET", "focus.php?nb_step="+value+"&orientation="+orientation+"&toggler="+toggler, true); - xmlhttp.send(); + function focus(toggler) { + var value = $("#nb_step").val(); + var orientation = $("#orientation").val(); + var xmlhttp = new XMLHttpRequest(); + xmlhttp.open("GET", "pipeline/focus.php?nb_step="+value+"&orientation="+orientation+"&toggler="+toggler, true); + xmlhttp.send(); } -function pump() { - var volume = $("#volume").val(); - var flowrate = $("#flowrate").val(); - var direction = $("#direction").val(); - var xmlhttp = new XMLHttpRequest(); - xmlhttp.open("GET", "pump.php?volume="+volume+"&flowrate="+flowrate+"&direction="+direction, true); - xmlhttp.send(); + function pump() { + var volume = $("#volume").val(); + var flowrate = $("#flowrate").val(); + var direction = $("#direction").val(); + var xmlhttp = new XMLHttpRequest(); + xmlhttp.open("GET", "pipeline/pump.php?volume="+volume+"&flowrate="+flowrate+"&direction="+direction, true); + xmlhttp.send(); } + + function write(){ + + var xmlhttp = new XMLHttpRequest(); + xmlhttp.open("GET", "pipeline/write.php?txt=ceciestuntexte", true); + xmlhttp.send(); + + } + }); diff --git a/pipeline/pump.php b/pipeline/pump.php index 01d1244..65ae392 100644 --- a/pipeline/pump.php +++ b/pipeline/pump.php @@ -4,5 +4,5 @@ $flowrate = $_REQUEST["flowrate"]; $direction = $_REQUEST["direction"]; -$output = shell_exec('/usr/bin/python3 pump.py '.$volume.' '.$flowrate.' '.$direction); +$output = shell_exec('/usr/bin/python3 /var/www/html/pipeline/pump.py '.$volume.' '.$flowrate.' '.$direction); ?> diff --git a/pipeline/pump.py b/pipeline/pump.py index 44c8898..52b0e68 100644 --- a/pipeline/pump.py +++ b/pipeline/pump.py @@ -5,7 +5,7 @@ from time import sleep import sys vol = int(sys.argv[1]) -flowrate = int(sys.argv[2]) +flowrate = float(sys.argv[2]) dir = str(sys.argv[3]) kit = MotorKit() diff --git a/pipeline/write.php b/pipeline/write.php new file mode 100644 index 0000000..94132d0 --- /dev/null +++ b/pipeline/write.php @@ -0,0 +1,6 @@ +