From 328464219a02c014caf1608a27a898900cad8456 Mon Sep 17 00:00:00 2001 From: eugue Date: Thu, 27 Jan 2011 14:28:20 -0500 Subject: mobile shake behavior added. --- behaviors/MobileShakeBehavior.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 behaviors/MobileShakeBehavior.py (limited to 'behaviors/MobileShakeBehavior.py') diff --git a/behaviors/MobileShakeBehavior.py b/behaviors/MobileShakeBehavior.py new file mode 100644 index 0000000..e25e929 --- /dev/null +++ b/behaviors/MobileShakeBehavior.py @@ -0,0 +1,17 @@ +from operationscore.Behavior import * +import util.Strings as Strings + +class MobileShakeBehavior(Behavior): + def processResponse(self, sensorInputs, recursiveInputs): + #print sensorInputs + ret = [] + for sInput in sensorInputs: + outDict = dict(sInput) + if 'type' in sInput and sInput['type'] == 2: + outDict['Location'] = '{x}>' + str(0) + ',{y}>' + str(0) + outDict['Color'] = [sInput['r'], sInput['g'], sInput['b']] + else: # dumb invisible pixel + outDict['Location'] = (-1, -1) + outDict['Color'] = [0, 0, 0] + ret.append(outDict) + return (ret, recursiveInputs) -- cgit v1.2.3