Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python3
- # Testing IIO SS
- # Found this source, well partially parts, on wiki.analog.com
- import sys
- import os
- from flask import Flask, render_template
- app = Flask(__name__)
- @app.route("/")
- @app.route("/<state>")
- def sab(state=None):
- if state == "my_samples":
- my_uri = sys.argv[1] if len(sys.argv) >= 3 else "192.168.7.2:8080"
- my_samples = sys.argv[2] if len(sys.argv) >= 3 else 200
- print("Executing trigger_now attribute for trigger0");
- print("for uri: " + str(my_uri))
- print("for " + str(my_samples) + " samples\n");
- i = 0
- while i < int(my_samples):
- i+=1
- os.system("iio_attr -u "+my_uri+" -d trigger0 trigger_now 1 \n")
- print("triggered "+str(i)+" times\n" )
- template_data = {
- "title" : state,
- }
- return render_template("Saber.html", message=state)
- if __name__=="__main__":
- app.run(host="0.0.0.0", port=8080, debug=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement