modif and order

master
Slayr 4 vuotta sitten
vanhempi 9a1dbd592b
commit ad1b8d28a2

@ -1,105 +1,120 @@
// TV.OUT LIBRARY
#include <TVout.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] = "";
// TV.OUT LIBRARY
#include <TVout.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 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
const char *animals[] = {"repetative", " ", "on", "cockroach"}; //A0
const char *BOBZ[] = {"labour", "silhouette", "bark", "or", "alligators ", "pitbulls", "depending"}; //A1
const char *part3[] = {"like", "wind", "not", "overdo"}; //A2
const char *part4[] = {
"dont be scared",
" dont avoid",
"you are soft",
" HANDS"
};
const byte letter = 25;
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"};
//AM
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 = "01:00 ";
const char t4[] PROGMEM = "02:00";
const char t5[] PROGMEM = "03:00";
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] = "";
//
//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
const int BUTTON2 = 5; //B2
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
//III
const char *part3[] = {"at night they", "like", "", "or", "dont be scared", "not ", "overdo", "street", " HANDS", "by day"}; //P3 [0-9]
int val1= 0;
int val2= 0;
int val3= 0;
int val4= 0;
int val5= 0;
int val6= 0;
int val7= 0;
//ALPHA
const byte letter = 25;
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"};
const char msg1[] PROGMEM = {" you did see me"};
const char msg2[] PROGMEM = {" it fell out"};
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() {
toggle_1 = analogRead(A6); //P1
toggle_2 = analogRead(A5); //P2
toggle_3 = analogRead(A4); //P3
toggle_4 = analogRead(A3); //P4
toggle_5 = analogRead(A2); //P5
toggle_6 = analogRead(A1); //P6
toggle_7 = analogRead(A0); //P7
val1 = digitalRead(BUTTON1);
val2 = digitalRead(BUTTON2);
val3 = digitalRead(BUTTON3);
val4 = digitalRead(BUTTON4);
val5 = digitalRead(BUTTON5);
val6 = digitalRead(BUTTON6);
val7 = digitalRead(BUTTON7);
//int l = strlen(string_table);
//shuffle(input, l );
//TV.println(input);
//delay(200);
pot_1 = analogRead(A0); //P1
pot_2 = analogRead(A1); //P2
pot_3 = analogRead(A2); //P3
pot_4 = analogRead(A3); //P4
pot_5 = analogRead(A4); //P5
pot_6 = analogRead(A5); //P6
pot_7 = analogRead(A6); //P7
val1 = digitalRead(BUTTON1);
val2 = digitalRead(BUTTON2);
val3 = digitalRead(BUTTON3);
val4 = digitalRead(BUTTON4);
val5 = digitalRead(BUTTON5);
val6 = digitalRead(BUTTON6);
val7 = digitalRead(BUTTON7);
//B1
if (val1 == HIGH) {
TV.select_font(font4x6);
TV.print("POETRY");
Serial.print("POETRY"); //SEND TX
TV.draw_line(60,20,60,76,WHITE);
} //done
if (val1 == HIGH) {
TV.select_font(font4x6);
TV.print("POETRY");
Serial.print("POETRY"); //SEND TX
TV.draw_line(60,20,60,76,WHITE);
} //done
//B2
if (val2 == HIGH) {
TV.select_font(font6x8);
TV.print("corner");
TV.draw_line(20,20,60,76,WHITE);
if(toggle_4 < 500){
TV.print("worst-case scenario",10,10);
Serial.print("worst-case scenario"); //SEND TX
}
}
// \CORNER
if (val2 == HIGH) {
if (pot_4 <500){
TV.select_font(font6x8);
TV.print("corner");
TV.draw_line(20,20,60,76,WHITE);}
if(pot_4 > 500){
TV.select_font(font8x8);
TV.print(10,10,"worst-case scenario");
Serial.print("worst-case scenario"); //SEND TX
}
}
//B3
//crash
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);
Serial.print("cigarette"); ////SEND TX
}
//crash CIG
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);
Serial.print("cigarette"); ////SEND TX
}
}
//B4
//blinking
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 (val4 == HIGH) {
if(pot_2 < 100) {
TV.clear_screen();
TV.print("dry eyes red eyes itchy eyes");
}
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
//RECEIVES TX
if (val5 == HIGH) {
TV.print((char)Serial.read());
TV.delay(20);
}
//TX IN
if (val5 == HIGH) {
TV.print((char)Serial.read());
TV.delay(50);
}
//B6
//alpha
if (val6 == HIGH) {
TV.print(letters[random(0,letter)]);
}
if (val6 == HIGH) {
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
//TEXT OUT
if (val7 == HIGH) {
//SHUFFLE sentance
//int l = strlen(input);
//shuffle(input, l );
//TV.println(input);
//delay(100);
//Serial.print("SUN IS DOWN"); //TXT OUT
if (val7 == HIGH) {
//SHUFFLE list/ times
for (int i = 0; i < 9; i++) {
strcpy_P(buffer, (char *)pgm_read_word(&(string_table[i])));
shuffle(buffer, strlen(buffer));
TV.print(buffer);
delay(100);
for (int i = 0; i < 9; i++) {
strcpy_P(buffer, (char *)pgm_read_word(&(string_table[i])));
shuffle(buffer, strlen(buffer));
TV.print(buffer);
delay(100);
}
}
}
if(toggle_5 >500){
//P5 [main]
if(pot_5 >500){
//P1
//map
int animal; //animals
animal = map(toggle_1, 10, 1023, 0, 3);
TV.print(animals[animal]);
delay(50);
if (toggle_1<10){
TV.select_font(font4x6);
TV.print(" ");
delay(500);
}
//space&slower
if (pot_1<10){
TV.select_font(font4x6);
TV.print(" ");
delay(500);
}
//map I
int p1; //animals
p1 = map(pot_1, 10, 1023, 0, 5);
TV.select_font(font4x6);
TV.print(part1[p1]);
delay(50);
//P2
//string list
int BOB; //BOBZ
BOB = map(toggle_2, 0, 1023, 0, 6);
TV.print(BOBZ[BOB]);
TV.delay(50);
//map II
int p2; //BOBZ
p2 = map(pot_2, 0, 1023, 0, 8);
TV.select_font(font4x6);
TV.print(part2[p2]);
TV.delay(50);
//P3
//map
int w1; //words
w1 = map(toggle_3, 0, 1023, 0, 3);
TV.print(words[w1]);
TV.delay(50);
//map III
int p3; //words
p3 = map(pot_3, 0, 1023, 0, 9);
TV.select_font(font4x6);
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
//draw and text
if(toggle_6>0 & toggle_6<100 ){
if(pot_6>0 & pot_6<100 ){
TV.invert();
TV.print(10,10,F("stretched torso abs rocks "));
}
else if(toggle_6>100 & toggle_6<200){
TV.print(30,50,F("where are you going"));
delay(50);
}
else if(toggle_6>200 & toggle_6<300){
TV.select_font(font8x8ext);
TV.print(50,50,F("to step into a dark place"));
}
else if(toggle_6>350 & toggle_6<500){
TV.print(10,70,"need someone to play with");
}
else if(toggle_6>500 & toggle_6<1023){
TV.print(10,10,F("stretched torso abs rocks "));
}
else if(pot_6>100 & pot_6<200){
TV.print(30,50,F("where are you going"));
delay(50);
}
else if(pot_6>200 & pot_6<300){
TV.select_font(font8x8ext);
TV.print(50,50,F("TO STEP INTO A DARK PLACE"));
}
else if(pot_6>300 & pot_6<400){
TV.print("");
}
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
//
//int p4;
//p4 = map(toggle_7, 0, 250, 0, 3);
//TV.print(part4[p4]);
//delay(100);
if (toggle_7>0 & toggle_7<500){
for (int i = 0; i < 3; i++) {
strcpy_P(buffer, (char *)pgm_read_word(&(string_table2[i])));
shuffle(buffer, strlen(buffer));
TV.print(buffer);
delay(300);
}
}
if (pot_7<100){
TV.clear_screen();
TV.select_font(font6x8);
for (byte k = 0; k < strlen(msg1); k++) {
charmsg1 = pgm_read_byte_near(msg1 + k);
TV.print(charmsg1);
delay(500);}
}
else if (pot_7>100 & pot_7<300){
TV.clear_screen();
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.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");
}
}
else if (pot_7<999){
TV.select_font(font4x6);
TV.print("");
}
@ -320,7 +392,7 @@ if (toggle_1<10){
//P5
//7777777...
else if(toggle_5 <100){
else if(pot_5 <100){
TV.print("7");
}

Ladataan…
Peruuta
Tallenna