modif and order

master
Slayr 5 years ago
parent 9a1dbd592b
commit ad1b8d28a2

@ -1,105 +1,120 @@
// TV.OUT LIBRARY // TV.OUT LIBRARY
#include <TVout.h> #include <TVout.h>
#include <fontALL.h> #include <fontALL.h>
//
// for incoming serial data
int incomingByte = 0;
// TV.OUT LIBRARY
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;
// P1-P7
int toggle_1;
int toggle_2;
int toggle_3;
int toggle_4;
int toggle_5;
int toggle_6;
int toggle_7;
//SHUFFLE TEXT
void shuffle(char *array, size_t n)
{
if (n > 1)
{
size_t i;
for (i = 0; i < n - 1; i++)
{
size_t j = i + rand() / (RAND_MAX / (n - i) + 1);
int t = array[j];
array[j] = array[i];
array[i] = t;
}
}
}
const char t0[] PROGMEM = "20:00"; // "String 0" etc are strings to store - change to suit.
const char t1[] PROGMEM = "21:00";
const char t2[] PROGMEM = "22:00";
const char t3[] PROGMEM = "sun";
const char t4[] PROGMEM = "is";
const char t5[] PROGMEM = "down";
const char t6[] PROGMEM = "23:00";
const char t7[] PROGMEM = "00:00";
const char t8[] PROGMEM = "PAVEMENT";
// Then set up a table to refer to your strings.
const char *const string_table[] PROGMEM = {t0, t1, t2, t3, t4, t5, t6, t7, t8};
const char *const string_table2[] PROGMEM = {t0, t1, t2};
char input[] = "sundown9";
char buffer[255] = "";
// for incoming serial data
int incomingByte = 0;
//
// TV.OUT LIBRARY
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;
//
// P1-P7
int pot_1;
int pot_2;
int pot_3;
int pot_4;
int pot_5;
int pot_6;
int pot_7;
// B1-B7
const int BUTTON1 = 10; //B1
const int BUTTON2 = 9; //B2
const int BUTTON3 = 8; //B3
const int BUTTON4 = 7; //B4
const int BUTTON5 = 6; //B5
const int BUTTON6 = 5; //B6
const int BUTTON7 = 4; //B7
int val1= 0;
int val2= 0;
int val3= 0;
int val4= 0;
int val5= 0;
int val6= 0;
int val7= 0;
//
//SHUFFLE TEXT
void shuffle(char *array, size_t n)
{
if (n > 1)
{
size_t i;
for (i = 0; i < n - 1; i++)
{
size_t j = i + rand() / (RAND_MAX / (n - i) + 1);
int t = array[j];
array[j] = array[i];
array[i] = t;
}
}
}
//TEXT //AM
const char *animals[] = {"repetative", " ", "on", "cockroach"}; //A0 const char t0[] PROGMEM = "20:00"; // "String 0" etc are strings to store - change to suit.
const char t1[] PROGMEM = "21:00";
const char *BOBZ[] = {"labour", "silhouette", "bark", "or", "alligators ", "pitbulls", "depending"}; //A1 const char t2[] PROGMEM = "22:00";
const char t3[] PROGMEM = "01:00 ";
const char *part3[] = {"like", "wind", "not", "overdo"}; //A2 const char t4[] PROGMEM = "02:00";
const char t5[] PROGMEM = "03:00";
const char *part4[] = { const char t6[] PROGMEM = "23:00";
"dont be scared", const char t7[] PROGMEM = "00:00";
" dont avoid", const char t8[] PROGMEM = "PAVEMENT";
"you are soft", // Then set up a table to refer to your strings.
" HANDS" const char *const string_table[] PROGMEM = {t0, t1, t2, t3, t4, t5, t6, t7, t8};
}; const char *const string_table2[] PROGMEM = {t0, t1, t2};
const byte letter = 25; char input[] = "SUNDOWN9";
char *letters[letter] = {"RUFF","A","B","C","D","RUDE","E","F","G","K","L","repetitive labour","M","N","O","P","R","S","T","U","V","W","Y","Z"}; char buffer[255] = "";
//
//TEXT
const char *words[] ={"street", "at night they", "by day"}; //I
const char *part1[] = {"repetative", "bench ", "on", "cockroach", "", " [you are soft] ",}; //P1 [0-5]
//II
const char *part2[] = {"labour", "silhouette ", "bark ", " wind", "alligators ", "pitbulls", "", "depending, ", " dont avoid",}; //P2 [0-8]
const int BUTTON1 = 4; //B1 //III
const int BUTTON2 = 5; //B2 const char *part3[] = {"at night they", "like", "", "or", "dont be scared", "not ", "overdo", "street", " HANDS", "by day"}; //P3 [0-9]
const int BUTTON3 = 6; //B3
const int BUTTON4 = 7; //B4
const int BUTTON5 = 8; //B5
const int BUTTON6 = 9; //B6
const int BUTTON7 = 10; //B7
int val1= 0; //ALPHA
int val2= 0; const byte letter = 25;
int val3= 0; char *letters[letter] = {"RUFF","A","B","C","D","RUDE","E","F","G","K","L","repetitive labour","M","N","O","P","R","S","T","U","V","W","Y","Z"};
int val4= 0;
int val5= 0; const char msg1[] PROGMEM = {" you did see me"};
int val6= 0; const char msg2[] PROGMEM = {" it fell out"};
int val7= 0; const char msg3[] PROGMEM = {" like you hear me"};
unsigned int displayInt;
char charmsg1;
char charmsg2;
char charmsg3;
@ -124,192 +139,249 @@ void setup() {
void loop() { void loop() {
toggle_1 = analogRead(A6); //P1 pot_1 = analogRead(A0); //P1
toggle_2 = analogRead(A5); //P2 pot_2 = analogRead(A1); //P2
toggle_3 = analogRead(A4); //P3 pot_3 = analogRead(A2); //P3
toggle_4 = analogRead(A3); //P4 pot_4 = analogRead(A3); //P4
toggle_5 = analogRead(A2); //P5 pot_5 = analogRead(A4); //P5
toggle_6 = analogRead(A1); //P6 pot_6 = analogRead(A5); //P6
toggle_7 = analogRead(A0); //P7 pot_7 = analogRead(A6); //P7
val1 = digitalRead(BUTTON1); val1 = digitalRead(BUTTON1);
val2 = digitalRead(BUTTON2); val2 = digitalRead(BUTTON2);
val3 = digitalRead(BUTTON3); val3 = digitalRead(BUTTON3);
val4 = digitalRead(BUTTON4); val4 = digitalRead(BUTTON4);
val5 = digitalRead(BUTTON5); val5 = digitalRead(BUTTON5);
val6 = digitalRead(BUTTON6); val6 = digitalRead(BUTTON6);
val7 = digitalRead(BUTTON7); val7 = digitalRead(BUTTON7);
//int l = strlen(string_table);
//shuffle(input, l );
//TV.println(input);
//delay(200);
//B1 //B1
if (val1 == HIGH) { if (val1 == HIGH) {
TV.select_font(font4x6); TV.select_font(font4x6);
TV.print("POETRY"); TV.print("POETRY");
Serial.print("POETRY"); //SEND TX Serial.print("POETRY"); //SEND TX
TV.draw_line(60,20,60,76,WHITE); TV.draw_line(60,20,60,76,WHITE);
} //done } //done
//B2 //B2
if (val2 == HIGH) { // \CORNER
TV.select_font(font6x8); if (val2 == HIGH) {
TV.print("corner"); if (pot_4 <500){
TV.draw_line(20,20,60,76,WHITE); TV.select_font(font6x8);
TV.print("corner");
if(toggle_4 < 500){ TV.draw_line(20,20,60,76,WHITE);}
TV.print("worst-case scenario",10,10);
Serial.print("worst-case scenario"); //SEND TX if(pot_4 > 500){
} TV.select_font(font8x8);
} TV.print(10,10,"worst-case scenario");
Serial.print("worst-case scenario"); //SEND TX
}
}
//B3 //B3
//crash //crash CIG
if (val3 == HIGH) { if (val3 == HIGH) {
for (int i=0; i<TV.hres(); i++) { for (int i=0; i<TV.hres(); i++) {
TV.print(i,44,F("cigarette")); TV.print(i,44,F("cigarette"));
TV.select_font(font8x8ext); TV.select_font(font8x8ext);
TV.print(i,i,F("TTTTTTTTTTTTTT")); TV.print(i,i,F("TTTTTTTTTTTTTT"));
TV.delay(200); TV.delay(200);
Serial.print("cigarette"); ////SEND TX Serial.print("cigarette"); ////SEND TX
}
} }
}
//B4 //B4
//blinking //blinking
if (val4 == HIGH) { if (val4 == HIGH) {
TV.print(letters[random(0,letter)]); if(pot_2 < 100) {
TV.select_font(font4x6); TV.clear_screen();
TV.print(10,10,F("good evening")); TV.print("dry eyes red eyes itchy eyes");
TV.draw_rect(20,20,33,76,0,0); }
TV.draw_line(20,20,33,76,1);
TV.clear_screen(); else if(pot_2 > 1000) {
} TV.print(10,10,F(" >>>>>>>>>>>>>>>>okokokok>>>>>>>>>>>>>>>>>>>>dont be scared "));
TV.delay(50);
}
else {
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();
}
}
//B5 //B5
//RECEIVES TX //TX IN
if (val5 == HIGH) { if (val5 == HIGH) {
TV.print((char)Serial.read()); TV.print((char)Serial.read());
TV.delay(20); TV.delay(50);
} }
//B6 //B6
//alpha //alpha
if (val6 == HIGH) { if (val6 == HIGH) {
TV.print(letters[random(0,letter)]); if(pot_1 < 400){
} TV.select_font(font6x8);
TV.print ("girls wish to risk");
Serial.print ("girls wish to risk");
}
if(pot_1 > 400){
TV.print(letters[random(0,letter)]);
}
}
//B6 //B6
//TEXT OUT //TEXT OUT
if (val7 == HIGH) { if (val7 == HIGH) {
//SHUFFLE sentance
//int l = strlen(input);
//shuffle(input, l );
//TV.println(input);
//delay(100);
//Serial.print("SUN IS DOWN"); //TXT OUT
//SHUFFLE list/ times //SHUFFLE list/ times
for (int i = 0; i < 9; i++) { for (int i = 0; i < 9; i++) {
strcpy_P(buffer, (char *)pgm_read_word(&(string_table[i]))); strcpy_P(buffer, (char *)pgm_read_word(&(string_table[i])));
shuffle(buffer, strlen(buffer)); shuffle(buffer, strlen(buffer));
TV.print(buffer); TV.print(buffer);
delay(100); delay(100);
}
} }
}
//P5 [main]
if(toggle_5 >500){ if(pot_5 >500){
//P1 //P1
//map //space&slower
int animal; //animals if (pot_1<10){
animal = map(toggle_1, 10, 1023, 0, 3); TV.select_font(font4x6);
TV.print(animals[animal]); TV.print(" ");
delay(50); delay(500);
}
if (toggle_1<10){ //map I
TV.select_font(font4x6); int p1; //animals
TV.print(" "); p1 = map(pot_1, 10, 1023, 0, 5);
delay(500); TV.select_font(font4x6);
} TV.print(part1[p1]);
delay(50);
//P2 //P2
//string list //map II
int BOB; //BOBZ int p2; //BOBZ
BOB = map(toggle_2, 0, 1023, 0, 6); p2 = map(pot_2, 0, 1023, 0, 8);
TV.print(BOBZ[BOB]); TV.select_font(font4x6);
TV.delay(50); TV.print(part2[p2]);
TV.delay(50);
//P3 //P3
//map //map III
int w1; //words int p3; //words
w1 = map(toggle_3, 0, 1023, 0, 3); p3 = map(pot_3, 0, 1023, 0, 9);
TV.print(words[w1]); TV.select_font(font4x6);
TV.delay(50); TV.print(part3[p3]);
TV.delay(50);
//P4
if (pot_4>100 & pot_4<500){
TV.print("");
}
if (pot_4>100 & pot_4<500){
TV.print("SUN IS DOWN");
delay(50);
}
if (pot_4>500 & pot_4<1023){
//SHUFFLE sentance
int l = strlen(input);
shuffle(input, l );
TV.print(input);
delay(20);
Serial.print("SUN IS DOWN"); //TXT OUT
}
//P6 //P6
//draw and text //draw and text
if(toggle_6>0 & toggle_6<100 ){ if(pot_6>0 & pot_6<100 ){
TV.invert(); TV.invert();
TV.print(10,10,F("stretched torso abs rocks ")); TV.print(10,10,F("stretched torso abs rocks "));
} }
else if(toggle_6>100 & toggle_6<200){ else if(pot_6>100 & pot_6<200){
TV.print(30,50,F("where are you going")); TV.print(30,50,F("where are you going"));
delay(50); delay(50);
} }
else if(toggle_6>200 & toggle_6<300){ else if(pot_6>200 & pot_6<300){
TV.select_font(font8x8ext); TV.select_font(font8x8ext);
TV.print(50,50,F("to step into a dark place")); TV.print(50,50,F("TO STEP INTO A DARK PLACE"));
} }
else if(toggle_6>350 & toggle_6<500){ else if(pot_6>300 & pot_6<400){
TV.print(10,70,"need someone to play with"); TV.print("");
} }
else if(toggle_6>500 & toggle_6<1023){ else if(pot_6>300 & pot_6<400){
TV.print("time to speak");
}
else if(pot_6>500 & pot_6<900){
TV.print(10,70," need someone to play with");
}
else if(pot_6>900 & pot_6<1023){
TV.print("scratch");
}
TV.print("scratch");
}
//P7 //P7
// if (pot_7<100){
//int p4; TV.clear_screen();
//p4 = map(toggle_7, 0, 250, 0, 3); TV.select_font(font6x8);
//TV.print(part4[p4]); for (byte k = 0; k < strlen(msg1); k++) {
//delay(100); charmsg1 = pgm_read_byte_near(msg1 + k);
TV.print(charmsg1);
if (toggle_7>0 & toggle_7<500){ delay(500);}
for (int i = 0; i < 3; i++) { }
strcpy_P(buffer, (char *)pgm_read_word(&(string_table2[i])));
shuffle(buffer, strlen(buffer)); else if (pot_7>100 & pot_7<300){
TV.print(buffer); TV.clear_screen();
delay(300); TV.select_font(font6x8);
} for (byte k = 0; k < strlen(msg2); k++) {
} charmsg2 = pgm_read_byte_near(msg2 + k);
TV.print(charmsg2);
delay(300);}
}
else if (pot_7>300 & pot_7<500){
TV.clear_screen();
TV.select_font(font6x8);
for (byte k = 0; k < strlen(msg3); k++) {
charmsg3 = pgm_read_byte_near(msg3 + k);
TV.print(charmsg3);
delay(50);}
}
else if (toggle_7>500 & toggle_7<800){ else if (pot_7>500 & pot_7<800){
TV.select_font(font8x8ext); TV.select_font(font8x8ext);
TV.print(30,10,F("lean on a car")); TV.print(30,10,F("lean on a car"));
} }
else if (toggle_7>800 & toggle_7<1023){
//TV.select_font(font8x8ext); else if (pot_7>800 & pot_7<999){
TV.select_font(font4x6);
TV.print("lean on a car"); TV.print("lean on a car");
} }
else if (pot_7<999){
TV.select_font(font4x6);
TV.print("");
}
@ -320,7 +392,7 @@ if (toggle_1<10){
//P5 //P5
//7777777... //7777777...
else if(toggle_5 <100){ else if(pot_5 <100){
TV.print("7"); TV.print("7");
} }

Loading…
Cancel
Save