summaryrefslogtreecommitdiff
path: root/grc/examples/xmlrpc/xmlrpc_client_script.py
diff options
context:
space:
mode:
Diffstat (limited to 'grc/examples/xmlrpc/xmlrpc_client_script.py')
-rw-r--r--grc/examples/xmlrpc/xmlrpc_client_script.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/grc/examples/xmlrpc/xmlrpc_client_script.py b/grc/examples/xmlrpc/xmlrpc_client_script.py
new file mode 100644
index 000000000..956fa07fb
--- /dev/null
+++ b/grc/examples/xmlrpc/xmlrpc_client_script.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+
+import time
+import random
+import xmlrpclib
+
+#create server object
+s = xmlrpclib.Server("http://localhost:1234")
+
+#randomly change parameters of the sinusoid
+for i in range(10):
+ #generate random values
+ new_freq = random.uniform(0, 5000)
+ new_ampl = random.uniform(0, 2)
+ new_offset = random.uniform(-1, 1)
+ #set new values
+ time.sleep(1)
+ s.set_freq(new_freq)
+ time.sleep(1)
+ s.set_ampl(new_ampl)
+ time.sleep(1)
+ s.set_offset(new_offset)
+