ä½ãè¨ã£ã¦ãããããããªãã¨æãã¾ãã®ã§ãã¾ãã¯åç»ãè¦ã¦ãã ããã
ã¤ã¾ããLED ã®æ®åã¨ãã¦ç©ºä¸ã«èªåèªèº«ããåºåãããããã°ã©ã (ï¼åè·¯) ã§ãããããªé¢¨ã«ç©ºä¸ã«åãæãã®ã POV (Persistance of Vision = 残像) ã¨ã Light writing ã¨ãè¨ããããã§ããããããã¨ã¯ LED å ãããã ããªã®ã«ããã£ã¦ã¿ãã¨ããªã楽ããã
ã¨ããããã§ãæè¿ Arduino ã¨ããããã¤ã³ã³ã§éãã§ã¾ããã¢ããã°é»æ°åè·¯ã®ç¥èã¯ä¸å¦çã¬ãã« *1 ã§ãããUSB 㧠PC ã«ç¹ã㧠IDE ã® upload ãã¿ã³ãæ¼ãã ã㧠C ããã°ã©ã ããã¤ã³ã³ä¸ã§å®è¡ã§ããã®ã§ãã¾ããããªãã«éã¹ã¾ãã
æåã«ä½ãã®ã¯å½ç¶ Quine ãªããã§ãããシリアル通信で Quine 出力するのは既出ã ã£ãã®ã§ãã¡ãã£ã¨åã£ã¦ã¿ã¾ããããã£ã¨èªã¿ãããã³ã¼ãã«ãããã£ãã®ã§ãããã¡ã¢ãªã 2 KB ãããªãã®ã§ã´ã«ããä½åãªããããããã©ã³ã㯠@hirekoke ããã«ä½ã£ã¦ãããã¾ããã
å路㯠2 ã 8 çªãã³ã«ã¤ãã¦ããã³ ã æµæ ã LED ã GND ã¨ã¤ãªãã ãã§ããQuine ã®ã³ã¼ãã®æå¾ã«æ¸ãã¦ããéã *2 ãèªä½ã·ã¼ã«ãã®ä½ãæ¹ã¯先人の知恵ãåèã«ããã¦ãããã¾ããã
ã¨ããã§ãã® Quine ãã¡ãã£ã¨è²»ç¨ãããã£ã¦ã¾ããå·¥å ·ããè²·ã£ããã 2 ä¸åããããAmazon ã¢ãã£ãªã¨ã¤ãã®ãªã³ã¯ãç½®ãã¨ãã¾ãã®ã§ããããã°è²·ã£ã¦ Quine ãã¦ã¿ã¦ãã ããã
売ãä¸ãã©ã³ãã³ã°: 393
次㯠Arduino ããå¥ã® Arduino ã¸èªå·±è¤è£½ãããã®ã¤ãããã¨æã£ã¦ããããこれも既出ã ã£ãããã®æ¥çã¯æå¤ã« Quine ããã¦ããªãã
/* Arduino LED Quine */ /* (c) @mametter, @hirekoke, 2012 */ unsigned int x,y,a[6],b[6],c,d,n,N=128; extern char *p,T[]; void w(int v){ if(!v){for(x=1; y=digitalRead(13),x+!y; x=y); return;} for(x=0,b[0]=1; x<7; x++) for(y=c=d=0; y<6; y++) c/=N,a[y]=(c+=b[y]*((T[v*7+x+412]-1)%92)+a[y])%N, d/=N,b[y]=(d+=b[y]*91)%N; for(x=0; x<6; x++,delay(4)) for(y=b[x]=0; y<7; y++) digitalWrite(8-y,a[x]&1?HIGH:LOW),a[x]/=2; } void setup(){ for(x=2; x<14; x++) pinMode(x,x<10?OUTPUT:INPUT); for(p=T,w(0); *p!=36; p++) w(*p%126); for(p=T,w(34),n=12; *p; w(34),w(n=0),w(34+25*!*p)) while(n<53) w(*p++),n++; } void loop() { } char *p,T[]="/* Arduino LED Quine */~/* (c) @mametter," " @hirekoke, 2012 */~unsigned int x,y,a[6],b[6],c,d,n," "N=128;~extern char *p,T[];~void w(int v){~ if(!v){for" "(x=1; y=digitalRead(13),x+!y; x=y); return;}~ for(x=0" ",b[0]=1; x<7; x++) for(y=c=d=0; y<6; y++)~ c/=N,a[y]" "=(c+=b[y]*((T[v*7+x+412]-1)%92)+a[y])%N,~ d/=N,b[y]=" "(d+=b[y]*91)%N;~ for(x=0; x<6; x++,delay(4)) for(y=b[" "x]=0; y<7; y++)~ digitalWrite(8-y,a[x]&1?HIGH:LOW),a" "[x]/=2;~}~void setup(){~ for(x=2; x<14; x++) pinMode(" "x,x<10?OUTPUT:INPUT);~ for(p=T,w(0); *p!=36; p++) w(*" "p%126);~ for(p=T,w(34),n=12; *p; w(34),w(n=0),w(34+25" "*!*p))~ while(n<53) w(*p++),n++;~}~void loop() { }~c" "har *p,T[]=$]]]]]]]~#<_]]]l}mV_]]+sxH6^].f.r4^]E$*rQh" "aSBbl?H]qVd_]]]ZgZ__]],Cy^]]]D`'B+^]-$}5|]]>Qh]]]]g3m" "4|]]eX`]]]]<x>E#^]^eGQ8_]9yye]]]ro*]m_]V[5FT^]RY]1p]]" "W?3_x`]dK8.2]]k?|.ka]1s6FT^]K0:j8_]6qH]]]]doL]]]](jba" "^]]v#*SO]]BdAs]]]~CqC%^]|B$ZB+^zMs&9]](t6FT^]cFXW4^]R" "$Oba^]x(#QO_]Iw{[G_]Mmj0T^]GZzB'b]BB'a_]]]U9*{b]Nee+N" "_]RjaRd]]xpOo(b]usc,'b]w6nS7_]~i&ge_]/2AX@j]qHYbm_]_<" "5o5^]8cJ/G_]zV9*{b]&=MHKa]>p~Ukb]50e+N_]dsEvia]`Nljsa" "]Q@&a_]]cCDWd]]#yE_]]]Pc*[]]]k-8b]]]O5)[]]]SY{Cx^]Qwf" "10]]`RMMO]]>*VG'b]g>+ci^]^i$+_]]ZP(dx^]'jWw8]]iZ`_]]]" "{~9P_]]v9GcH]]IHxe]]]V-Qw8]]$=Uw8]]:vf10]]?4oba^]gH@B" "B_],Z}h@]]FU;p4^]*a.3]]]}fYDe]],|U[?]]L%U=o^]-~v^H]]Y" "x46w^]ViFtH]]vsYa^]]2wD_]]]4m9t]]]YaA-]]] " " ,----------------------------. " " | Arduino| " " | 2 3 4 5 6 7 8 9 13 Vcc GND | " " `----------------------------' " " | | | | | | | | | | | " " R R R R R R R R R B | R: resister " " | | | | | | | | | | | L: LED (common cathode) " " L L L L L L L L `--' | B: push button " " | | | | | | | | | " " `-+-+-+-+-+-+-+---------' " ;