{"id":1355,"date":"2011-09-23T14:30:32","date_gmt":"2011-09-23T05:30:32","guid":{"rendered":"http:\/\/mkusunoki.net\/?p=1355"},"modified":"2013-12-06T22:01:26","modified_gmt":"2013-12-06T13:01:26","slug":"4x4x4-led-cube-%e3%82%ad%e3%83%83%e3%83%88%e3%82%92%e4%bd%9c%e3%82%8a%e3%81%be%e3%81%97%e3%81%9f-%e3%81%9d%e3%81%ae2","status":"publish","type":"post","link":"https:\/\/mkusunoki.net\/?p=1355","title":{"rendered":"4x4x4 LED Cube \u30ad\u30c3\u30c8\u3092\u4f5c\u308a\u307e\u3057\u305f \u305d\u306e2"},"content":{"rendered":"<p><a href=\"http:\/\/mkusunoki.net\/?attachment_id=1356\" rel=\"attachment wp-att-1356\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"680\" src=\"http:\/\/mkusunoki.net\/wp\/wp-content\/uploads\/2011\/09\/DSC_0668-1024x680.jpg\" alt=\"\" title=\"DSC_0668\"  class=\"alignnone size-medium wp-image-1356\" srcset=\"https:\/\/mkusunoki.net\/wp\/wp-content\/uploads\/2011\/09\/DSC_0668-1024x680.jpg 1024w, https:\/\/mkusunoki.net\/wp\/wp-content\/uploads\/2011\/09\/DSC_0668-320x212.jpg 320w, https:\/\/mkusunoki.net\/wp\/wp-content\/uploads\/2011\/09\/DSC_0668.jpg 1280w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/a><\/p>\n<p>\n\u660e\u65e5\u306f\u5927\u962a(\u304a\u5f7c\u5cb8\u306e\u5893\u53c2\u308a)\u3067\u660e\u5f8c\u65e5\u306f\u30d0\u30a4\u30aa\u30ea\u30f3\u306e\u30ec\u30c3\u30b9\u30f3\u65e5\u3068\u9023\u4f11\u3067\u3059\u304c\u601d\u3044\u306e\u307b\u304b\u4e88\u5b9a\u304c\u3042\u3063\u3066\u6642\u9593\u3042\u308b\u306e\u306f\u4eca\u65e5\u306a\u306e\u3067\u3059\u3002PC\u306e\u524d\u306b\u5ea7\u308b\u5ea6\u306b\u3001\u4f5c\u3063\u3066\u653e\u7f6e\u3057\u3066\u3044\u305f LED CUBE \u304c\u76ee\u306b\u5165\u308b\u306e\u304c\u6c17\u306b\u306a\u308a\u59cb\u3081\u3066\u7d50\u5c40\u306e\u3068\u3053\u308d\u671d\u304b\u3089LED CUBE \u306e\u30bd\u30fc\u30b9\u3092\u3044\u3058\u3063\u3066\u8868\u793a\u306e\u30d1\u30bf\u30fc\u30f3\u3092\u5897\u3084\u3057\u3066\u307f\u307e\u3057\u305f\u3002\u5348\u524d\u4e2d\u3084\u3063\u3066\u3001\u5348\u5f8c\u306b\u306a\u3063\u305f\u4eca\u52d5\u753b\u4e0a\u3052\u305f\u3068\u3053\u308d\u3067\u3059\u3002\u3082\u3046\u3061\u3087\u3063\u3068\u6642\u9593\u3042\u308c\u3070\u30d1\u30bf\u30fc\u30f3\u5897\u3084\u305d\u3046\u3068\u306f\u601d\u3044\u307e\u3059\u304c\u3001\u4e00\u5fdc\u30ea\u30d3\u30f3\u30b0\u306b\u653e\u308a\u51fa\u3057\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u3002\u7d50\u69cb\u3044\u3044\u3067\u3059\u3002\n<\/p>\n<ul>\n<li>LED \u3092\u30e9\u30f3\u30c0\u30e0\u306b\u5149\u3089\u305b\u308b(\u30d1\u30c3\u30d1\u30c3\u3068\u8868\u793a\u5207\u308a\u66ff\u3048)\n<li>LED \u3092\u30e9\u30f3\u30c0\u30e0\u306b\u5149\u3089\u305b\u308b(\u3086\u3063\u304f\u308a\u3068\u8868\u793a\u5207\u308a\u66ff\u3048)\n<li>\u9762\u30d1\u30bf\u30fc\u30f3\u3092\u52d5\u304b\u3059(2\u7a2e\u985e)\n<li>\u30ad\u30c3\u30c8\u306e\u6a19\u6e96\u30d1\u30bf\u30fc\u30f3\n<\/ul>\n<p>\n\u304c\u8868\u793a\u51fa\u6765\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002\u3053\u308c\u3067\u3082\u30b3\u30f3\u30d1\u30a4\u30eb\u3057\u305f\u7d50\u679c\u306f 4708 bytes \u3060\u305d\u3046\u3067\u3059\u3002ATMega328\u306a\u306e\u3067\u307e\u3060\u307e\u3060\u4f59\u88d5\u3042\u308a\u307e\u3059\u306d\u3002\n<\/p>\n<p>[nicodo]sm15687878[\/nicodo]<\/p>\n<p>\nYoutube \u306f<a href=\"http:\/\/www.youtube.com\/watch?v=1Cz5_KeqS-8\">\u3053\u3061\u3089<\/a>\n<\/p>\n<p>\n\u30bd\u30fc\u30b9\u306f\u306a\u3093\u306e\u5de5\u592b\u3082\u306a\u3044\u306e\u3067\u79d8\u5bc6\u306b\u3059\u3053\u3068\u3082\u7121\u304f\u529b\u6280\u3067\u3053\u3093\u306a\u611f\u3058\u3068\u3044\u3046\u3053\u3068\u3092\u4ee5\u4e0b\u306b\u3055\u3089\u3057\u3066\u304a\u304d\u307e\u3059\u308f\u3002\n<\/p>\n<p>\/*<\/p>\n<p>  gallileo-7 4x4x4 LED Kit<\/p>\n<p>  LED Pattern modified by Masahiro Kusunoki z-gypsy @ nifty.com<br \/>\n  2011\/9\/23 ver 0.1<\/p>\n<p>*\/<\/p>\n<p>\/\/74LS164\u306b\u63a5\u7d9a\u3055\u308c\u3066\u3044\u308bpin\u3092\u8a2d\u5b9a<br \/>\n#define dPin 2<br \/>\n#define cPin 3<\/p>\n<p>\/\/LED\u306e\u30ab\u30bd\u30fc\u30c9\u306b\u3064\u306a\u304c\u3063\u3066\u3044\u308bpin\u3092\u8a2d\u5b9a<br \/>\nint layerPin[4] = {8,9,10,11};<\/p>\n<p>\/\/LED\u306e\u8868\u793a\u72b6\u614b\u3092\u4fdd\u5b58<br \/>\nint buf[4];<\/p>\n<p>void setup(){<\/p>\n<p>  \/\/\u4f7f\u7528\u3059\u308bpin\u3092\u8a2d\u5b9a<br \/>\n  for(int i=0;i<4;i++){\n    pinMode(layerPin[i],OUTPUT);\n  }\n  pinMode(dPin,OUTPUT);\n  pinMode(cPin,OUTPUT);\n}\n\n\nvoid loop() {\n  int rand;\n\n  clearLed();\n\n  rand = random(5);\n  switch(rand) {\n    case 0:\n      pattern01();\n      break;\n    case 1:\n      pattern02();\n      break;\n    case 2:\n      pattern03();\n      break;\n    case 3:\n      pattern04();\n      break;\n    case 4:\n      pattern05();\n      break;\n  }\n  \n}\n\n\/\/val\u306e\u4e2d\u8eab\u3067\u521d\u671f\u5316\u3059\u308b\nvoid bufclear(int val){\n  for(int i=0;i<4;i++){\n      buf[i] = val;\n  }\n}\n\nvoid bufclear2(int val1, int val2, int val3, int val4) {\n  buf[0] = val1;\n  buf[1] = val2;\n  buf[2] = val3;\n  buf[3] = val4;\n}\n\/\/buffer\u3092\u8868\u793a\u3059\u308b gallileo-7 original code\nvoid sync(int time, int buffer[]){\n  int i, j, count;\n  for(count = 0; count < time; count++){\n    for(i = 0; i < 4; i++) {\n      shiftOut(dPin, cPin, MSBFIRST, (buffer[i] >> 8));<br \/>\n      shiftOut(dPin, cPin, MSBFIRST, buffer[i]);<br \/>\n      digitalWrite(layerPin[i], HIGH);<br \/>\n      delayMicroseconds(500);<br \/>\n      digitalWrite(layerPin[i], LOW);<br \/>\n    }<br \/>\n  }<br \/>\n}<br \/>\nvoid sync2(int buffer[]) {<br \/>\n  int i, j, count;<br \/>\n  for(count = 0; count < 3000; count++) {\n    for(i = 0; i < 4; i++) {\n      shiftOut(dPin, cPin, MSBFIRST, (buffer[i] >> 8));<br \/>\n      shiftOut(dPin, cPin, MSBFIRST, buffer[i]);<br \/>\n      j = count \/ 15;<br \/>\n      switch(j) {<br \/>\n        case 0:<br \/>\n        case 199:<br \/>\n          sync03(i, 0, 0);<br \/>\n          break;<br \/>\n        case 1:<br \/>\n        case 198:<br \/>\n          sync03(i, 43, 0);<br \/>\n          break;<br \/>\n        case 2:<br \/>\n        case 197:<br \/>\n          sync03(i, 86, 0);<br \/>\n          break;<br \/>\n        case 3:<br \/>\n        case 196:<br \/>\n          sync03(i, 125, 0);<br \/>\n          break;<br \/>\n        case 4:<br \/>\n        case 195:<br \/>\n          sync03(i, 161, 0);<br \/>\n          break;<br \/>\n        case 5:<br \/>\n        case 194:<br \/>\n          sync03(i, 192, 0);<br \/>\n          break;<br \/>\n        case 6:<br \/>\n        case 193:<br \/>\n          sync03(i, 217, 0);<br \/>\n          break;<br \/>\n        case 7:<br \/>\n        case 192:<br \/>\n          sync03(i, 235, 0);<br \/>\n          break;<br \/>\n        case 8:<br \/>\n        case 191:<br \/>\n          sync03(i, 246, 0);<br \/>\n          break;<br \/>\n        default:<br \/>\n          sync03(i, 500, 0);<br \/>\n          break;<\/p>\n<p>      }<br \/>\n    }<br \/>\n  }<br \/>\n}<\/p>\n<p>void sync03(int i, unsigned int delay01, unsigned int delay02) {<br \/>\n  digitalWrite(layerPin[i], HIGH);<br \/>\n  if(delay01 > 0) {<br \/>\n    delayMicroseconds(delay01);<br \/>\n  }<br \/>\n  digitalWrite(layerPin[i], LOW);<br \/>\n  if(delay02 > 0) {<br \/>\n    delayMicroseconds(delay02);<br \/>\n  }<br \/>\n}<\/p>\n<p>void pattern01() {<br \/>\n    bufclear(0xFFFF);<br \/>\n  \/\/\u8868\u793a<br \/>\n  for(int i=0;i<20;i++){\n    sync(50,buf);\n  }\n  \/\/buf\u30920x00\u3067\u521d\u671f\u5316\n  bufclear(0x00);\n  \/\/\u3072\u3068\u3064\u305a\u3064\u70b9\u706f\n  for(int i=0;i<4;i++){\n    for(int j=0;j<16;j++){\n      buf[i] = buf[i] << 1;\n      buf[i] = buf[i] | 0b01;\n      sync(50,buf);\n    }\n  }\n  \/\/\u3072\u3068\u3064\u305a\u3064\u6d88\u706f\n  for(int i=0;i<4;i++){\n    for(int j=0;j<16;j++){\n      buf[i] = buf[i] << 1;\n      sync(50,buf);\n    }\n  }\n}\n\nvoid pattern02() {\n    int i;\n    \n    for(i = 0; i < random(10); i++) {\n    bufclear2(random(65535),random(65535),random(65535),random(65535));\n    sync2(buf);\n  }\n}\n\nvoid pattern03() {\n    int i;\n    \n    for(i = 0; i < random(10); i++) {\n    bufclear2(random(65535),random(65535),random(65535),random(65535));\n    sync(500, buf);\n  }\n}\n\nvoid pattern04() {\n    \n  bufclear2(0xffff,0x0000,0x0000,0x0000);\n  sync(100, buf);\n  bufclear2(0x0000,0xffff,0x0000,0x0000);\n  sync(100, buf);\n  bufclear2(0x0000,0x0000,0xffff,0x0000);\n  sync(100, buf);\n  bufclear2(0x0000,0x0000,0x0000,0xffff);\n  sync(100, buf);\n  bufclear2(0x0000,0x0000,0xffff,0x0000);\n  sync(100, buf);  \n  bufclear2(0x0000,0xffff,0x0000,0x0000);\n  sync(100, buf);\n  bufclear2(0xffff,0x0000,0x0000,0x0000);\n  sync(100, buf);\n\n  bufclear2(0x000f,0x000f,0x000f,0x000f);\n  sync(100, buf);\n  bufclear2(0x00f0,0x00f0,0x00f0,0x00f0);\n  sync(100, buf);\n  bufclear2(0x0f00,0x0f00,0x0f00,0x0f00);\n  sync(100, buf);\n  bufclear2(0xf000,0xf000,0xf000,0xf000);\n  sync(100, buf);\n  bufclear2(0x0f00,0x0f00,0x0f00,0x0f00);\n  sync(100, buf);\n  bufclear2(0x00f0,0x00f0,0x00f0,0x00f0);\n  sync(100, buf);\n  bufclear2(0x000f,0x000f,0x000f,0x000f);\n  sync(100, buf);\n  \n  bufclear2(0x1111,0x1111,0x1111,0x1111);\n  sync(100, buf);\n  bufclear2(0x2222,0x2222,0x2222,0x2222);\n  sync(100, buf);\n  bufclear2(0x4444,0x4444,0x4444,0x4444);\n  sync(100, buf);\n  bufclear2(0x8888,0x8888,0x8888,0x8888);\n  sync(100, buf);\n  bufclear2(0x4444,0x4444,0x4444,0x4444);\n  sync(100, buf);\n  bufclear2(0x2222,0x2222,0x2222,0x2222);\n  sync(100, buf);\n  bufclear2(0x1111,0x1111,0x1111,0x1111);\n  sync(100, buf);\n}\n\nvoid pattern05() {\n  int i;\n  int rand;\n  \n  for(i = 0; i < 12; i++) {\n    rand = random(12);\n    switch(rand) {\n      case 0:\n          bufclear2(0x1111,0x1111,0x1111,0x1111);\n          break;\n      case 1:\n          bufclear2(0x2222,0x2222,0x2222,0x2222);\n          break;\n      case 2:\n          bufclear2(0x4444,0x4444,0x4444,0x4444);\n          break;\n      case 3:\n          bufclear2(0x8888,0x8888,0x8888,0x8888);\n          break;\n      case 4:\n          bufclear2(0x000f,0x000f,0x000f,0x000f);\n          break;\n      case 5:\n          bufclear2(0x00f0,0x00f0,0x00f0,0x00f0);\n          break;\n      case 6:\n          bufclear2(0x0f00,0x0f00,0x0f00,0x0f00);\n          break;\n      case 7:\n          bufclear2(0xf000,0xf000,0xf000,0xf000);\n          break;\n      case 8:\n          bufclear2(0xffff,0x0000,0x0000,0x0000);\n          break;\n      case 9:\n          bufclear2(0x0000,0xffff,0x0000,0x0000);\n          break;\n      case 10:\n          bufclear2(0x0000,0x0000,0xffff,0x0000);\n          break;\n      case 11:\n          bufclear2(0x0000,0x0000,0x0000,0xffff);\n          break;\n    }\n    sync(100, buf);\n  }\n}\n\nvoid clearLed() {\n  int i;\n  \n  bufclear(0x00);\n  for(i = 0; i < 20; i++) {\n    sync(50,buf);\n  }\n}\n[\/c]\n<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u660e\u65e5\u306f\u5927\u962a(\u304a\u5f7c\u5cb8\u306e\u5893\u53c2\u308a)\u3067\u660e\u5f8c\u65e5\u306f\u30d0\u30a4\u30aa\u30ea\u30f3\u306e\u30ec\u30c3\u30b9\u30f3\u65e5\u3068\u9023\u4f11\u3067\u3059\u304c\u601d\u3044\u306e\u307b\u304b\u4e88\u5b9a\u304c\u3042\u3063\u3066\u6642\u9593\u3042\u308b\u306e\u306f\u4eca\u65e5\u306a\u306e\u3067\u3059\u3002PC\u306e\u524d\u306b\u5ea7\u308b\u5ea6\u306b\u3001\u4f5c\u3063\u3066\u653e\u7f6e\u3057\u3066\u3044\u305f LED CUBE \u304c\u76ee\u306b\u5165\u308b\u306e\u304c\u6c17\u306b\u306a\u308a\u59cb\u3081\u3066\u7d50\u5c40\u306e\u3068\u3053\u308d\u671d &hellip; <a href=\"https:\/\/mkusunoki.net\/?p=1355\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;4x4x4 LED Cube \u30ad\u30c3\u30c8\u3092\u4f5c\u308a\u307e\u3057\u305f \u305d\u306e2&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[17,7],"tags":[110,111,60],"class_list":["post-1355","post","type-post","status-publish","format-standard","hentry","category-17","category-kousaku","tag-led","tag-led-cube","tag-60"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/mkusunoki.net\/index.php?rest_route=\/wp\/v2\/posts\/1355","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mkusunoki.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mkusunoki.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mkusunoki.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mkusunoki.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1355"}],"version-history":[{"count":0,"href":"https:\/\/mkusunoki.net\/index.php?rest_route=\/wp\/v2\/posts\/1355\/revisions"}],"wp:attachment":[{"href":"https:\/\/mkusunoki.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1355"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mkusunoki.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1355"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mkusunoki.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1355"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}