From 517a093604bca0cf9a17953e0c5177b09cb84bdc Mon Sep 17 00:00:00 2001 From: Edgar O Silva Date: Mon, 28 Oct 2013 19:59:44 -0600 Subject: [PATCH] Added collision event to the messages example and updated collision example. --- examples/sphero_collision.coffee | 5 ++--- examples/sphero_messages.coffee | 5 +++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/examples/sphero_collision.coffee b/examples/sphero_collision.coffee index 0c2ad62..d552102 100644 --- a/examples/sphero_collision.coffee +++ b/examples/sphero_collision.coffee @@ -18,11 +18,10 @@ Cylon.robot ) me.sphero.on 'collision', (data) -> - me.sphero.setRGB(color) Logger.info 'collision:' - console.log("color: #{ parseInt(color, 16) } ") color = color ^ bitFilter - me.sphero.roll 60, Math.floor(Math.random() * 360) + console.log("color: #{ color.toString(16) } ") + me.sphero.setRGB(color) every 1.second, -> me.sphero.roll 90, Math.floor(Math.random() * 360) diff --git a/examples/sphero_messages.coffee b/examples/sphero_messages.coffee index e059c7b..fd98a29 100644 --- a/examples/sphero_messages.coffee +++ b/examples/sphero_messages.coffee @@ -20,6 +20,11 @@ Cylon.robot Logger.info 'message:' Logger.info data + me.sphero.on 'collision', (data) -> + me.sphero.setRGB(0xFF0000) + Logger.info 'collision:' + Logger.info data + me.sphero.on 'notification', (data) -> me.sphero.setRGB(0xFF0000) Logger.info 'notification:'