Advertisement
Guest User

ArduinoFlashProto

a guest
Feb 8th, 2013
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 7.57 KB | None | 0 0
  1. const int ledPin1 = 3;
  2. const int ledPin2 = 4;
  3. const int ledPin3 = 5;
  4. const int ledPin4 = 6;
  5. const int ledPin5 = 7;
  6. const int ledPin6 = 8;
  7. const int ledPin7 = 9;
  8. const int ledPin8 = 10;
  9. const int ledPin9 = 11;
  10. const int ledPin10 = 12;
  11. const int buttonPin = 13;
  12. int currentstate = 0;
  13. int previousstate = 0;
  14.  
  15. const int letterA[5][10] =
  16. {
  17. {1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
  18. {0, 0, 0, 0, 0, 1, 0, 0, 0, 1},
  19. {0, 0, 0, 0, 0, 1, 0, 0, 0, 1},
  20. {0, 0, 0, 0, 0, 1, 0, 0, 0, 1},
  21. {1, 1, 1, 1, 1, 1, 1, 1, 1, 0}
  22. };
  23.  
  24. int letterB[5][10] =
  25. {
  26. {1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
  27. {1, 0, 0, 0, 0, 1, 0, 0, 0, 1},
  28. {1, 0, 0, 0, 0, 1, 0, 0, 0, 1},
  29. {1, 0, 0, 0, 0, 1, 0, 0, 0, 1},
  30. {0, 1, 1, 1, 1, 1, 1, 1, 1, 0},
  31. };
  32.  
  33. int letterC[5][10] =
  34. {
  35. {0, 0, 0, 1, 1, 1, 1, 0, 0, 0},
  36. {0, 0, 1, 0, 0, 0, 0, 1, 0, 0},
  37. {0, 1, 0, 0, 0, 0, 0, 0, 1, 0},
  38. {1, 0, 0, 0, 0, 0, 0, 0, 0, 1},
  39. {1, 0, 0, 0, 0, 0, 0, 0, 0, 1},
  40. };
  41.  
  42. int letterD[5][10] =
  43. {
  44. {1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
  45. {1, 0, 0, 0, 0, 0, 0, 0, 0, 1},
  46. {1, 0, 0, 0, 0, 0, 0, 0, 0, 1},
  47. {1, 0, 0, 0, 0, 0, 0, 0, 0, 1},
  48. {0, 1, 1, 1, 1, 1, 1, 1, 1, 0},
  49. };
  50.  
  51. int letterE[5][10] =
  52. {
  53. {1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
  54. {1, 0, 0, 0, 0, 1, 0, 0, 0, 1},
  55. {1, 0, 0, 0, 0, 1, 0, 0, 0, 1},
  56. {1, 0, 0, 0, 0, 1, 0, 0, 0, 1},
  57. {1, 0, 0, 0, 0, 1, 0, 0, 0, 1},
  58. };
  59.  
  60. int letterF[5][10] =
  61. {
  62. {1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
  63. {0, 0, 0, 0, 0, 1, 0, 0, 0, 1},
  64. {0, 0, 0, 0, 0, 1, 0, 0, 0, 1},
  65. {0, 0, 0, 0, 0, 1, 0, 0, 0, 1},
  66. {0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
  67. };
  68.  
  69. int letterG[5][10] =
  70. {
  71. {1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
  72. {1, 0, 0, 0, 0, 0, 0, 0, 0, 1},
  73. {1, 0, 0, 0, 0, 0, 0, 0, 0, 1},
  74. {1, 0, 0, 1, 0, 0, 0, 0, 0, 1},
  75. {1, 1, 1, 1, 0, 0, 1, 1, 1, 1},
  76. };
  77.  
  78. int letterH[5][10] =
  79. {
  80. {1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
  81. {0, 0, 0, 0, 0, 0, 1, 0, 0, 0},
  82. {0, 0, 0, 0, 0, 0, 1, 0, 0, 0},
  83. {0, 0, 0, 0, 0, 0, 1, 0, 0, 0},
  84. {1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
  85. };
  86.  
  87. int letterI[5][10] =
  88. {
  89. {1, 0, 0, 0, 0, 0, 0, 0, 0, 1},
  90. {1, 0, 0, 0, 0, 0, 0, 0, 0, 1},
  91. {1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
  92. {1, 0, 0, 0, 0, 0, 0, 0, 0, 1},
  93. {1, 0, 0, 0, 0, 0, 0, 0, 0, 1},
  94. };
  95.  
  96. int letterJ[5][10] =
  97. {
  98. {1, 1, 1, 0, 0, 0, 0, 0, 0, 1},
  99. {1, 0, 0, 0, 1, 1, 0, 0, 0, 1},
  100. {0, 1, 1, 1, 1, 1, 1, 1, 1, 1},
  101. {0, 0, 0, 0, 1, 1, 0, 0, 0, 1},
  102. {0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
  103. };
  104.  
  105.  
  106. int letterK[5][10] =
  107. {
  108. {1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
  109. {1, 0, 0, 0, 0, 1, 0, 0, 0, 0},
  110. {0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
  111. {0, 1, 1, 0, 1, 1, 0, 1, 1, 0},
  112. {1, 0, 0, 0, 0, 0, 0, 0, 0, 1},
  113. };
  114.  
  115. int letterL[5][10] =
  116. {
  117. {1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
  118. {1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
  119. {1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
  120. {1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
  121. {1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
  122. };
  123.  
  124. int letterM[5][10] =
  125. {
  126. {1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
  127. {0, 0, 0, 0, 0, 0, 1, 1, 0, 0},
  128. {0, 0, 0, 0, 1, 1, 1, 0, 0, 0},
  129. {0, 0, 0, 0, 0, 0, 1, 1, 0, 0},
  130. {1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
  131. };
  132.  
  133. int letterN[5][10] =
  134. {
  135. {1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
  136. {0, 0, 0, 0, 0, 0, 0, 1, 1, 0},
  137. {0, 0, 0, 1, 1, 1, 1, 1, 0, 0},
  138. {0, 1, 1, 0, 0, 0, 0, 0, 0, 0},
  139. {1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
  140. };
  141.  
  142. int letterO[5][10] =
  143. {
  144. {1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
  145. {1, 0, 0, 0, 0, 0, 0, 0, 0, 1},
  146. {1, 0, 0, 0, 0, 0, 0, 0, 0, 1},
  147. {1, 0, 0, 0, 0, 0, 0, 0, 0, 1},
  148. {1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
  149. };
  150.  
  151. int letterP[5][10] =
  152. {
  153. {1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
  154. {0, 0, 0, 0, 1, 0, 0, 0, 0, 1},
  155. {0, 0, 0, 0, 1, 0, 0, 0, 0, 1},
  156. {0, 0, 0, 0, 0, 1, 0, 0, 1, 0},
  157. {0, 0, 0, 0, 0, 0, 1, 1, 0, 0},
  158. };
  159.  
  160. int letterQ[5][10] =
  161. {
  162. {1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
  163. {1, 0, 0, 0, 0, 0, 0, 0, 0, 1},
  164. {1, 0, 1, 0, 0, 0, 0, 0, 0, 1},
  165. {1, 1, 0, 0, 0, 0, 0, 0, 0, 1},
  166. {1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
  167. };
  168.  
  169. int letterR[5][10] =
  170. {
  171. {1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
  172. {1, 0, 0, 0, 0, 1, 0, 0, 0, 1},
  173. {0, 0, 1, 1, 1, 1, 1, 0, 0, 1},
  174. {0, 1, 1, 0, 1, 1, 0, 0, 0, 1},
  175. {0, 0, 0, 0, 0, 1, 1, 1, 1, 1},
  176. };
  177.  
  178. int letterS[5][10] =
  179. {
  180. {1, 0, 0, 0, 0, 1, 1, 1, 1, 1},
  181. {1, 0, 0, 0, 0, 1, 0, 0, 0, 1},
  182. {1, 0, 0, 0, 0, 1, 0, 0, 0, 1},
  183. {1, 0, 0, 0, 0, 1, 0, 0, 0, 1},
  184. {1, 1, 1, 1, 1, 1, 0, 0, 0, 1},
  185. };
  186.  
  187. int letterT[5][10] =
  188. {
  189. {0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
  190. {0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
  191. {1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
  192. {0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
  193. {0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
  194. };
  195.  
  196. int letterU[5][10] =
  197. {
  198. {1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
  199. {1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
  200. {1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
  201. {1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
  202. {1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
  203. };
  204.  
  205. int letterV[5][10] =
  206. {
  207. {0, 0, 1, 1, 1, 1, 1, 1, 1, 1},
  208. {0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
  209. {1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
  210. {0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
  211. {0, 0, 1, 1, 1, 1, 1, 1, 1, 1},
  212. };
  213.  
  214. int letterW[5][10] =
  215. {
  216. {0, 1, 1, 1, 1, 1, 1, 1, 1, 1},
  217. {1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
  218. {1, 1, 1, 1, 1, 1, 0, 0, 0, 0},
  219. {1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
  220. {1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
  221. };
  222.  
  223. int letterX[5][10] =
  224. {
  225. {1, 0, 0, 0, 0, 0, 0, 0, 1, 1},
  226. {0, 1, 1, 0, 0, 0, 1, 1, 0, 0},
  227. {0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
  228. {0, 1, 1, 0, 0, 0, 1, 1, 0, 0},
  229. {1, 1, 0, 0, 0, 0, 0, 0, 1, 1},
  230. };
  231.  
  232. int letterY[5][10] =
  233. {
  234. {0, 0, 0, 0, 0, 0, 0, 1, 1, 1},
  235. {0, 0, 0, 0, 0, 1, 1, 0, 0, 0},
  236. {1, 1, 1, 1, 1, 1, 0, 0, 0, 0},
  237. {0, 0, 0, 0, 0, 1, 1, 0, 0, 0},
  238. {0, 0, 0, 0, 0, 0, 0, 1, 1, 1},
  239. };
  240.  
  241. int letterZ[5][10] =
  242. {
  243. {1, 1, 0, 0, 0, 0, 0, 0, 0, 1},
  244. {1, 0, 1, 1, 0, 0, 0, 0, 0, 1},
  245. {1, 0, 0, 0, 1, 1, 1, 0, 0, 1},
  246. {1, 0, 0, 0, 0, 0, 0, 1, 0, 1},
  247. {1, 0, 0, 0, 0, 0, 0, 0, 1, 1},
  248. };
  249.  
  250. int blankSpace[5][10] =
  251. {
  252. {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
  253. {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
  254. {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
  255. {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
  256. {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
  257. };
  258.  
  259.  
  260. void setup()
  261. {
  262.     pinMode(ledPin1, OUTPUT);
  263.     pinMode(ledPin2, OUTPUT);
  264.     pinMode(ledPin3, OUTPUT);
  265.     pinMode(ledPin4, OUTPUT);
  266.     pinMode(ledPin5, OUTPUT);
  267.     pinMode(ledPin6, OUTPUT);
  268.     pinMode(ledPin7, OUTPUT);
  269.     pinMode(ledPin8, OUTPUT);
  270.     pinMode(ledPin9, OUTPUT);
  271.     pinMode(ledPin10, OUTPUT);
  272.     pinMode(buttonPin, INPUT);
  273.  
  274.  
  275. //All of my letters are going to be 10 tall and 5 wide, so I need a 5x10 matrix, since they will be sideways for the code
  276.  
  277. Serial.begin(9600);
  278.  
  279. }
  280.  
  281.    
  282.  
  283.  
  284. void loop()
  285. {
  286.  
  287. currentstate = digitalRead(buttonPin);
  288.  
  289. Serial.println("all clear");
  290. Serial.println(currentstate);
  291.  
  292. if (currentstate != previousstate)
  293.  
  294. {
  295.  
  296. Serial.println("flashy lights!");
  297.  
  298. for (int i=0; i<5; i++)
  299. {
  300.   for (int j=0; j<10; j++)
  301.   {
  302.     digitalWrite(j+3,letterH[i][j]);
  303.    
  304.   }
  305. delay(10);
  306. }
  307.  
  308. for (int i=0; i<5; i++)
  309. {
  310.   for (int j=0; j<10; j++)
  311.   {
  312.     digitalWrite(j+3,blankSpace[i][j]);
  313.    
  314.   }
  315. delay(10);
  316. }
  317.  
  318. for (int i=0; i<5; i++)
  319. {
  320.   for (int j=0; j<10; j++)
  321.   {
  322.     digitalWrite(j+3,letterE[i][j]);
  323.    
  324.   }
  325. delay(10);
  326. }
  327.  
  328. for (int i=0; i<5; i++)
  329. {
  330.   for (int j=0; j<10; j++)
  331.   {
  332.     digitalWrite(j+3,blankSpace[i][j]);
  333.    
  334.   }
  335. delay(10);
  336. }
  337.  
  338. for (int i=0; i<5; i++)
  339. {
  340.   for (int j=0; j<10; j++)
  341.   {
  342.     digitalWrite(j+3,letterL[i][j]);
  343.    
  344.   }
  345. delay(10);
  346. }
  347.  
  348. for (int i=0; i<5; i++)
  349. {
  350.   for (int j=0; j<10; j++)
  351.   {
  352.     digitalWrite(j+3,blankSpace[i][j]);
  353.    
  354.   }
  355. delay(10);
  356. }
  357.  
  358. for (int i=0; i<5; i++)
  359. {
  360.   for (int j=0; j<10; j++)
  361.   {
  362.     digitalWrite(j+3,letterL[i][j]);
  363.    
  364.   }
  365. delay(10);
  366. }
  367.  
  368. for (int i=0; i<5; i++)
  369. {
  370.   for (int j=0; j<10; j++)
  371.   {
  372.     digitalWrite(j+3,blankSpace[i][j]);
  373.    
  374.   }
  375. delay(10);
  376. }
  377.  
  378. for (int i=0; i<5; i++)
  379. {
  380.   for (int j=0; j<10; j++)
  381.   {
  382.     digitalWrite(j+3,letterO[i][j]);
  383.    
  384.   }
  385. delay(10);
  386. }
  387.  
  388. for (int i=0; i<5; i++)
  389. {
  390.   for (int j=0; j<10; j++)
  391.   {
  392.     digitalWrite(j+3,blankSpace[i][j]);
  393.    
  394.   }
  395. delay(30);
  396. }
  397.  
  398. previousstate = currentstate;
  399. }
  400.  
  401. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement