{"id":118,"date":"2009-09-23T16:08:09","date_gmt":"2009-09-23T20:08:09","guid":{"rendered":"http:\/\/www.logicalzero.com\/blog\/?p=118"},"modified":"2014-05-23T01:15:41","modified_gmt":"2014-05-23T05:15:41","slug":"random-idea-unique-ids-on-the-arduino","status":"publish","type":"post","link":"http:\/\/www.logicalzero.com\/blog\/?p=118","title":{"rendered":"Random idea: unique IDs on the Arduino"},"content":{"rendered":"<p>I was thinking about ways to create multiplayer games\/toys using the Arduino platform and realized a key difficulty: telling different Arduinos apart when there are more than two. Optimally, the system should not depend on one Arduino being the &#8216;boss&#8217; and should be as simple as possible for the programmer. I think I have a solution.<\/p>\n<p>This is the idea: modify the pre-compiler (or, more specifically, the IDE code that calls the precompiler) to automatically include a <tt>#define<\/tt> statement, defining <tt>MY_UNIQUE_ID<\/tt> as the last sixteen bits of the build time in milliseconds. The chances of two Arduino builds being done in the same thousandth of a second are extraordinarily low, effectively making the ID unique for all practical reasons. In the code, all the programmer needs to do is use <tt>MY_UNIQUE_ID<\/tt> as a variable.<\/p>\n<p>I&#8217;ll have to take a look at the Arduino IDE source.<\/p>\n<p><em>Update (9\/24): <\/em>A couple of people have commented on this on Facebook (where this appears via RSS), suggesting some dynamic, real-time solutions. These are good ideas, but the situation I was imagining isn&#8217;t one in which all the points would have access to each other simultaneously; instead, temporary connections are being made between units, probably by physical contact.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was thinking about ways to create multiplayer games\/toys using the Arduino platform and realized a key difficulty: telling different Arduinos apart when there are more than two. Optimally, the system should not depend on one Arduino being the &#8216;boss&#8217; and should be as simple as possible for the programmer. I think I have a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[8,6],"tags":[41,22,42],"_links":{"self":[{"href":"http:\/\/www.logicalzero.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/118"}],"collection":[{"href":"http:\/\/www.logicalzero.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.logicalzero.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.logicalzero.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.logicalzero.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=118"}],"version-history":[{"count":4,"href":"http:\/\/www.logicalzero.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/118\/revisions"}],"predecessor-version":[{"id":802,"href":"http:\/\/www.logicalzero.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/118\/revisions\/802"}],"wp:attachment":[{"href":"http:\/\/www.logicalzero.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=118"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.logicalzero.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=118"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.logicalzero.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=118"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}