From 99e9c540ef1f114a935a6670573542773cf78d9b Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Tue, 29 Mar 2016 10:10:12 +0100 Subject: [PATCH] add tick to Unicorn clock example --- hardware/unicorn/examples/Clock.json | 2 +- hardware/unicorn/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hardware/unicorn/examples/Clock.json b/hardware/unicorn/examples/Clock.json index d4fd484f..7f6e4301 100644 --- a/hardware/unicorn/examples/Clock.json +++ b/hardware/unicorn/examples/Clock.json @@ -1 +1 @@ -[{"id":"651b51cb.9ae4b","type":"rpi-unicorn","z":"40b203f2.bf4dfc","name":"","png":"0,0,0","bright":"20","x":530,"y":620,"wires":[]},{"id":"d886ebb5.d40378","type":"inject","z":"40b203f2.bf4dfc","name":"","topic":"","payload":"","payloadType":"date","repeat":"10","crontab":"","once":true,"x":100,"y":620,"wires":[["a14fe454.f951f8"]]},{"id":"a14fe454.f951f8","type":"function","z":"40b203f2.bf4dfc","name":"Simple graphical clock","func":"\n// array to hold \"random\" pixels\nvar ranNums = [];\n\n// create a non-overlapping array of random numbers 0-8\nfunction rerand() {\n var nums = [0,1,2,3,4,5,6,7,8];\n var i = nums.length;\n var j;\n ranNums = [];\n while (i--) {\n j = Math.floor(Math.random() * (i+1));\n ranNums.push(nums[j]);\n nums.splice(j,1);\n }\n}\n\n// Get the hours and minutes and split into tens and units\nvar d = new Date();\nvar h = d.getHours();\nvar m = d.getMinutes();\nvar hu = h%10;\nh = parseInt(h/10);\nvar mu = m%10;\nm = parseInt(m/10);\n\n// Do the tens of hours (red)\nrerand();\nnode.send({payload:\"1-3,1-3,0,0,0\"});\nfor (var i=0; i