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__':