From e09578da1da80aa641f2400265fe94c9951737e4 Mon Sep 17 00:00:00 2001 From: Scott Lawson Date: Tue, 27 Dec 2016 02:13:02 -0700 Subject: [PATCH] Updated dsp.py and led.py to be Python 3.5 compatible --- python/dsp.py | 2 +- python/led.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/python/dsp.py b/python/dsp.py index 5734408..7458e8f 100644 --- a/python/dsp.py +++ b/python/dsp.py @@ -15,7 +15,7 @@ class ExpFilter: self.value = val def update(self, value): - if not isinstance(self.value, (int, long, float)): + if isinstance(self.value, (list, np.ndarray, tuple)): alpha = value - self.value alpha[alpha > 0.0] = self.alpha_rise alpha[alpha <= 0.0] = self.alpha_decay diff --git a/python/led.py b/python/led.py index 4a22857..e3e4971 100644 --- a/python/led.py +++ b/python/led.py @@ -1,5 +1,6 @@ from __future__ import print_function from __future__ import division +from __future__ import unicode_literals import socket import numpy as np import config @@ -23,7 +24,7 @@ def update(): continue m += chr(i) + chr(p[0][i]) + chr(p[1][i]) + chr(p[2][i]) _prev_pixels = np.copy(p) - _sock.sendto(m, (config.UDP_IP, config.UDP_PORT)) + _sock.sendto(m.encode(), (config.UDP_IP, config.UDP_PORT)) if __name__ == '__main__':