Commit c0fe46cb authored by Nicholas Gar Hei Chan's avatar Nicholas Gar Hei Chan
Browse files

Added sampler file

parent 9475ccdc
......@@ -18,6 +18,7 @@ import sys
import os
import gcodeparser as gcp
import sampler
import flask
......@@ -129,8 +130,8 @@ class AutofdpPlugin(octoprint.plugin.SettingsPlugin,
while(self.movement_lock):
pass
reading = subprocess.run("./sample.sh", capture_output=True).stdout.decode("utf-8").strip() == '0'
reading = sampler.sample_probe(7, 0, 0.15)
#subprocess.run("./sample.sh", capture_output=True).stdout.decode("utf-8").strip() == '0'
return reading
# ------------------------------------------------------------------------- #
......
import os
import subprocess
import time
def sample_probe(solenoid_pin, sense_pin, delay_time):
os.system("gpio mode {} in".format(sense_pin))
os.system("gpio mode {} out".format(solenoid_pin))
os.system("gpio write {} 1".format(solenoid_pin))
time.sleep(delay_time)
res = subprocess.check_output("gpio read {}".format(sense_pin), shell=True)
os.system("gpio write {} 0".format(solenoid_pin))
return int(res) == 0
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment