conf template and bugfixs

This commit is contained in:
sam 2020-09-29 22:40:10 +02:00
parent 93a5bf7fe5
commit 71bcd8ba68
17 changed files with 1433 additions and 74 deletions

View file

@ -165,7 +165,7 @@ class DAC(object):
return self.readresp("d")
def prepare(self):
self.conn.sendall('p')
self.conn.sendall(b'p')
return self.readresp('p')
def stop(self):

View file

@ -1,4 +1,17 @@
#!/usr/bin/env python
'''
Improved dac.py and talk.py (by Jacob Potter). Pimped by Sam Neurohack.
- python3
- works with nannou visualisers
- can talk to a given etherdream knowing it's IP.
v0.1.0
'''
#
# j4cDAC test code
#
@ -17,6 +30,19 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import dac3 as dac
import argparse
import sys
argsparser = argparse.ArgumentParser(description="Draw a square on a laser via Etherdream DAC")
argsparser.add_argument("-i","--ip",help="Etherdream IP (default : first etherdream broadcast received",default="True",type=str)
args = argsparser.parse_args()
etherIP = args.ip
class SquarePointStream(object):
'''
@ -88,8 +114,14 @@ class NullPointStream(object):
return [(0, 0, 0, 0, 0)] * n
#dac.find_dac()
if etherIP == "True":
print("Waiting for the first DAC broadcast...")
d = dac.DAC(dac.find_first_dac())
d = dac.DAC(dac.find_first_dac())
#d = dac.DAC("192.168.1.43")
else:
print("Using Etherdream :", etherIP)
d = dac.DAC(etherIP)
print("Sending points...")
d.play_stream(SquarePointStream())