awesome
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

prototype-mega.ino 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. #include <TVout.h>
  2. #include <fontALL.h>
  3. int incomingByte = 0; // for incoming serial data
  4. TVout TV;
  5. unsigned char x,y;
  6. int zOff = 150;
  7. int xOff = 0;
  8. int yOff = 0;
  9. int cSize = 50;
  10. int view_plane = 64;
  11. float angle = PI/60;
  12. int toggle_0;
  13. int toggle_1;
  14. int toggle_2;
  15. int toggle_3;
  16. int toggle_4;
  17. int toggle_5;
  18. const char *animals[] = {
  19. "cat",
  20. "dog",
  21. "mouse",
  22. "cockroach"
  23. }; //A0
  24. const char *BOBZ[] = {
  25. "BOB0",
  26. "BOB1",
  27. "BOB2",
  28. "BOB3",
  29. "BOB4",
  30. "BOB5",
  31. "BOB6"
  32. }; //A1
  33. const char *greets[] = {
  34. "alone",
  35. "Hi",
  36. "hey",
  37. "ayyy"}; //A2
  38. const byte letter = 10;
  39. char *letters[letter] = {
  40. "RUFF","A","B","C","D","RUDE","E","F","G","BAD"};
  41. char str[] = "hello";
  42. char str2[] = "at night they";
  43. char str3[] = "day";
  44. const char *words[] = {&str[3], &str2[0], &str3[1]}; //A3
  45. const int BUTTON1 = 44;
  46. const int BUTTON2 = 45;
  47. const int BUTTON3 = 46;
  48. const int BUTTON4 = 47;
  49. const int BUTTON5 = 48;
  50. const int BUTTON6 = 49;
  51. const int BUTTON7 = 50;
  52. const int BUTTON8 = 51;
  53. const int BUTTON9 = 52;
  54. int val1= 0;
  55. int val2= 0;
  56. int val3= 0;
  57. int val4= 0;
  58. int val5= 0;
  59. int val6= 0;
  60. int val7= 0;
  61. int val8= 0;
  62. int val9= 0;
  63. void setup() {
  64. Serial.begin(9600);
  65. TV.begin(PAL);
  66. TV.select_font(font4x6);
  67. pinMode(BUTTON1, INPUT);
  68. pinMode(BUTTON2, INPUT);
  69. pinMode(BUTTON3, INPUT);
  70. pinMode(BUTTON4, INPUT);
  71. pinMode(BUTTON5, INPUT);
  72. pinMode(BUTTON6, INPUT);
  73. pinMode(BUTTON7, INPUT);
  74. pinMode(BUTTON8, INPUT);
  75. pinMode(BUTTON9, INPUT);
  76. }
  77. void loop() {
  78. toggle_0 = analogRead(A0);
  79. toggle_1 = analogRead(A1);
  80. toggle_2 = analogRead(A2);
  81. toggle_3 = analogRead(A3);
  82. toggle_4 = analogRead(A4);
  83. toggle_5 = analogRead(A5);
  84. val1 = digitalRead(BUTTON1);
  85. val2 = digitalRead(BUTTON2);
  86. val3 = digitalRead(BUTTON3);
  87. val4 = digitalRead(BUTTON4);
  88. val5 = digitalRead(BUTTON5);
  89. val6 = digitalRead(BUTTON6);
  90. val7 = digitalRead(BUTTON7);
  91. val8 = digitalRead(BUTTON8);
  92. val9 = digitalRead(BUTTON9);
  93. if (val1 == HIGH) {
  94. TV.select_font(font4x6);
  95. TV.print("POETRY");
  96. Serial.print("POETRY");
  97. TV.draw_line(60,20,60,76,WHITE);
  98. }
  99. if (val2 == HIGH) {
  100. TV.select_font(font6x8);
  101. TV.print("blah");
  102. TV.draw_line(20,20,60,76,WHITE);
  103. if(toggle_3 < 500){
  104. TV.print("AFLY",10,10);
  105. }
  106. }
  107. if (val3 == HIGH) {
  108. for (int i=0; i<TV.hres(); i++) {
  109. TV.print(i,44,F("cigarette"));
  110. TV.select_font(font8x8ext);
  111. TV.print(i,i,F("TTTTTTTTTTTTTT"));
  112. TV.delay(200);
  113. }
  114. }
  115. if (val4 == HIGH) {
  116. TV.print(letters[random(0,letter)]);
  117. TV.select_font(font4x6);
  118. TV.print(10,10,F("good evening"));
  119. TV.draw_rect(20,20,33,76,0,0);
  120. TV.draw_line(20,20,33,76,1);
  121. TV.clear_screen();
  122. }
  123. if (val5 == HIGH) {
  124. TV.print((char)Serial.read());
  125. TV.delay(20);
  126. }
  127. if (val6 == HIGH) {
  128. TV.print(letters[random(0,letter)]);
  129. }
  130. if(toggle_4 >500){
  131. int animal; //animals
  132. animal = map(toggle_0, 0, 1023, 0, 3);
  133. TV.print(animals[animal]);
  134. delay(10);
  135. int BOB; //BOBZ
  136. BOB = map(toggle_1, 0, 1023, 0, 6);
  137. TV.print(BOBZ[BOB]);
  138. delay(10);
  139. int w1; //words
  140. w1 = map(toggle_2, 0, 1023, 0, 2);
  141. TV.print(words[w1]);
  142. delay(10);
  143. if(toggle_5 <100){
  144. TV.print(10,10,F("good evening"));
  145. }
  146. else if(toggle_5>200 & toggle_5<500){
  147. TV.print(30,50,F("where are you going"));
  148. }
  149. }
  150. else if(toggle_4 <100){
  151. TV.print("7");
  152. }
  153. //else {
  154. // TV.delay(20);
  155. //}
  156. }