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

196 lines
3.2 KiB
C++

#include <TVout.h>
#include <fontALL.h>
int incomingByte = 0; // for incoming serial data
TVout TV;
unsigned char x,y;
int zOff = 150;
int xOff = 0;
int yOff = 0;
int cSize = 50;
int view_plane = 64;
float angle = PI/60;
int toggle_0;
int toggle_1;
int toggle_2;
int toggle_3;
int toggle_4;
int toggle_5;
const char *animals[] = {
"cat",
"dog",
"mouse",
"cockroach"
}; //A0
const char *BOBZ[] = {
"BOB0",
"BOB1",
"BOB2",
"BOB3",
"BOB4",
"BOB5",
"BOB6"
}; //A1
const char *greets[] = {
"alone",
"Hi",
"hey",
"ayyy"}; //A2
const byte letter = 10;
char *letters[letter] = {
"RUFF","A","B","C","D","RUDE","E","F","G","BAD"};
char str[] = "hello";
char str2[] = "at night they";
char str3[] = "day";
const char *words[] = {&str[3], &str2[0], &str3[1]}; //A3
const int BUTTON1 = 44;
const int BUTTON2 = 45;
const int BUTTON3 = 46;
const int BUTTON4 = 47;
const int BUTTON5 = 48;
const int BUTTON6 = 49;
const int BUTTON7 = 50;
const int BUTTON8 = 51;
const int BUTTON9 = 52;
int val1= 0;
int val2= 0;
int val3= 0;
int val4= 0;
int val5= 0;
int val6= 0;
int val7= 0;
int val8= 0;
int val9= 0;
void setup() {
Serial.begin(9600);
TV.begin(PAL);
TV.select_font(font4x6);
pinMode(BUTTON1, INPUT);
pinMode(BUTTON2, INPUT);
pinMode(BUTTON3, INPUT);
pinMode(BUTTON4, INPUT);
pinMode(BUTTON5, INPUT);
pinMode(BUTTON6, INPUT);
pinMode(BUTTON7, INPUT);
pinMode(BUTTON8, INPUT);
pinMode(BUTTON9, INPUT);
}
void loop() {
toggle_0 = analogRead(A0);
toggle_1 = analogRead(A1);
toggle_2 = analogRead(A2);
toggle_3 = analogRead(A3);
toggle_4 = analogRead(A4);
toggle_5 = analogRead(A5);
val1 = digitalRead(BUTTON1);
val2 = digitalRead(BUTTON2);
val3 = digitalRead(BUTTON3);
val4 = digitalRead(BUTTON4);
val5 = digitalRead(BUTTON5);
val6 = digitalRead(BUTTON6);
val7 = digitalRead(BUTTON7);
val8 = digitalRead(BUTTON8);
val9 = digitalRead(BUTTON9);
if (val1 == HIGH) {
TV.select_font(font4x6);
TV.print("POETRY");
Serial.print("POETRY");
TV.draw_line(60,20,60,76,WHITE);
}
if (val2 == HIGH) {
TV.select_font(font6x8);
TV.print("blah");
TV.draw_line(20,20,60,76,WHITE);
if(toggle_3 < 500){
TV.print("AFLY",10,10);
}
}
if (val3 == HIGH) {
for (int i=0; i<TV.hres(); i++) {
TV.print(i,44,F("cigarette"));
TV.select_font(font8x8ext);
TV.print(i,i,F("TTTTTTTTTTTTTT"));
TV.delay(200);
}
}
if (val4 == HIGH) {
TV.print(letters[random(0,letter)]);
TV.select_font(font4x6);
TV.print(10,10,F("good evening"));
TV.draw_rect(20,20,33,76,0,0);
TV.draw_line(20,20,33,76,1);
TV.clear_screen();
}
if (val5 == HIGH) {
TV.print((char)Serial.read());
TV.delay(20);
}
if (val6 == HIGH) {
TV.print(letters[random(0,letter)]);
}
if(toggle_4 >500){
int animal; //animals
animal = map(toggle_0, 0, 1023, 0, 3);
TV.print(animals[animal]);
delay(10);
int BOB; //BOBZ
BOB = map(toggle_1, 0, 1023, 0, 6);
TV.print(BOBZ[BOB]);
delay(10);
int w1; //words
w1 = map(toggle_2, 0, 1023, 0, 2);
TV.print(words[w1]);
delay(10);
if(toggle_5 <100){
TV.print(10,10,F("good evening"));
}
else if(toggle_5>200 & toggle_5<500){
TV.print(30,50,F("where are you going"));
}
}
else if(toggle_4 <100){
TV.print("7");
}
//else {
// TV.delay(20);
//}
}