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.
300 lines
7.4 KiB
Java
300 lines
7.4 KiB
Java
////////////// All code below pertains to functionality that has no clear use yet. ////////////////////////////////////////////
|
|
|
|
/* Menu screen allows user to determine what type of interaction
|
|
they want with the euglena */
|
|
|
|
/*
|
|
void menu(String button1, String button2, String button3, String button4) {
|
|
strokeWeight(2);
|
|
stroke(50);
|
|
textSize(24);
|
|
|
|
//Back Button
|
|
fill(180);
|
|
ellipse ((displayWidth - menu.width)/2 - sizeButton*5.5, displayHeight/2 - sizeButton, sizeButton*2, sizeButton*2);
|
|
fill(50);
|
|
text(button1, (displayWidth - menu.width)/2 - sizeButton*5, displayHeight/2 + 10);
|
|
|
|
//ledSequence
|
|
fill(180);
|
|
ellipse((displayWidth - menu.width)/2 - sizeButton*2.5, displayHeight/2 - sizeButton, sizeButton*2, sizeButton*2);
|
|
fill(50);
|
|
text(button2, (displayWidth - menu.width)/2 - sizeButton*2.5 + sizeButton/2, displayHeight/2 + 10);
|
|
|
|
//limitedPaint
|
|
fill(180);
|
|
ellipse((displayWidth - menu.width)/2 + sizeButton/2, displayHeight/2 - sizeButton, sizeButton*2, sizeButton*2);
|
|
fill(50);
|
|
text(button3, (displayWidth - menu.width)/2 + sizeButton*1, displayHeight/2 + 10);
|
|
|
|
//levelDeveloper
|
|
fill(180);
|
|
ellipse((displayWidth - menu.width)/2 + sizeButton*3.5, displayHeight/2 -sizeButton, sizeButton*2, sizeButton*2);
|
|
fill(50);
|
|
text(button4, (displayWidth - menu.width)/2 + sizeButton*4, displayHeight/2 + 10);
|
|
}
|
|
|
|
void store(int num) {
|
|
if(startSession == 2) ledDirections.append(num);
|
|
if(startSession == 4) storedLED.append(num);
|
|
}
|
|
*/
|
|
|
|
|
|
/* Controls at what stage of LED activity the program is in */
|
|
/*
|
|
void ledSequence() {
|
|
switch(ledSession) {
|
|
case 0 : // Choose sequence
|
|
initLed();
|
|
break;
|
|
case 1 : // Turn on and off LED's in proper sequence for proper duration
|
|
runLed();
|
|
break;
|
|
case 2 :
|
|
endLed(); // Resets all variables used
|
|
break;
|
|
default : //Doodle
|
|
startSession = 5;
|
|
break;
|
|
}
|
|
}
|
|
*/
|
|
|
|
/* Allows user to choose a certain number of LED's
|
|
to run in sequence */
|
|
/*
|
|
void initLed() {
|
|
strokeWeight(2);
|
|
stroke(50);
|
|
|
|
//DOWN Button
|
|
fill(180);
|
|
ellipse((displayWidth - menu.width)/2, displayHeight/2 + sizeButton * 1.5, sizeButton, sizeButton);
|
|
fill(50);
|
|
textSize(17);
|
|
text("DOWN", (displayWidth - menu.width)/2 + 3, displayHeight/2 + sizeButton * 1.5 + sizeButton/2 + 5);
|
|
|
|
//UP Button
|
|
fill(180);
|
|
ellipse((displayWidth - menu.width)/2, displayHeight/2 - sizeButton * 1.5, sizeButton, sizeButton);
|
|
fill(50);
|
|
textSize(18);
|
|
text("UP", (displayWidth - menu.width)/2 + 18, displayHeight/2 - sizeButton * 1.5 + sizeButton/2 + 5);
|
|
|
|
//LEFT Button
|
|
fill(180);
|
|
ellipse((displayWidth - menu.width)/2 - sizeButton * 1.5, displayHeight/2, sizeButton, sizeButton);
|
|
fill(50);
|
|
textSize(18);
|
|
text("LEFT", (displayWidth - menu.width)/2 - sizeButton * 1.5 + 10, displayHeight/2 + sizeButton/2 + 5);
|
|
|
|
//RIGHT Button
|
|
fill(180);
|
|
ellipse((displayWidth - menu.width)/2 + sizeButton * 1.5, displayHeight/2, sizeButton, sizeButton);
|
|
fill(50);
|
|
textSize(18);
|
|
text("RIGHT", (displayWidth - menu.width)/2 + sizeButton * 1.5 + 5, displayHeight/2 + sizeButton/2 + 5);
|
|
|
|
if(startSession == 2) {
|
|
//Load preset Level
|
|
loadButton();
|
|
|
|
//Instructions
|
|
textSize(56);
|
|
text("Choose 3 directions to create LED sequence", 250, 100);
|
|
|
|
if (ledDirections.size() == ledLimit) { //Check to see if user has selected 3 directions
|
|
ledSession = 1;
|
|
ledTime = millis();
|
|
}
|
|
} else if (startSession == 4) {
|
|
finishButton();
|
|
}
|
|
}
|
|
*/
|
|
|
|
/* Turns on LED's for given amount of time */
|
|
/*
|
|
void runLed() {
|
|
if (load) {
|
|
ledOn(tempLED);
|
|
} else {
|
|
ledOn(ledDirections);
|
|
}
|
|
}
|
|
|
|
void ledOn(IntList LED) {
|
|
if (LED.size() > 0) {
|
|
println(LED.get(0));
|
|
arduino.digitalWrite(LED.get(0), Arduino.HIGH); // Turns on first led in sequence
|
|
if (millis() - ledTime >= ledDelay) { // checks that time on has been met
|
|
arduino.digitalWrite(LED.get(0), Arduino.LOW); // Turns of led after given amount of time
|
|
LED.remove(0);
|
|
ledTime = millis();
|
|
}
|
|
} else {
|
|
ledSession = 2; // Move to next section of activty - end
|
|
}
|
|
}
|
|
*/
|
|
|
|
|
|
/* Reset used variables for future use */
|
|
/*
|
|
void endLed() {
|
|
ledSession = 0;
|
|
startSession = 5;
|
|
load = false;
|
|
}
|
|
*/
|
|
|
|
/* Activity in which users have limited amounts of paint to accomplish goal */
|
|
/*
|
|
void limitedPaint() {
|
|
switch (paintSession) {
|
|
case 0 :
|
|
initPaint(); // Allows user option to load preset level or draw on their own
|
|
break;
|
|
case 1 :
|
|
runPaint(); // Loads preset level
|
|
break;
|
|
case 2 :
|
|
endPaint(); // Resets used variables
|
|
break;
|
|
default : // Doodle
|
|
startSession = 5;
|
|
break;
|
|
}
|
|
}
|
|
*/
|
|
|
|
/* Draws appropriate buttons on screen, free draw still allowed */
|
|
/*
|
|
void initPaint() {
|
|
if (startSession == 3) loadButton();
|
|
finishButton();
|
|
}
|
|
*/
|
|
|
|
|
|
/* Loads preset level */
|
|
/*
|
|
void runPaint() {
|
|
if(load) {
|
|
for(int i = 0; i < storedColor.size(); i++) {
|
|
stroke(colorList[storedColor.get(i)]);
|
|
strokeWeight(storedPenWidth.get(i));
|
|
point(storedXCoord.get(i), storedYCoord.get(i));
|
|
}
|
|
}
|
|
finishButton();
|
|
}
|
|
*/
|
|
|
|
/* Resets used variables */
|
|
/*
|
|
void endPaint() {
|
|
load = false;
|
|
paintLimit.clear();
|
|
clearDisplay();
|
|
paintSession = 0;
|
|
startSession = 5;
|
|
}
|
|
*/
|
|
|
|
/* Allows users to create and store doodles and LED sequences */
|
|
/*
|
|
void levelDeveloper() {
|
|
switch(levelSession) {
|
|
case 0 :
|
|
finishDeveloper(); // Resets used variables
|
|
break;
|
|
case 1 :
|
|
initLevelDeveloper(); // Choose what type of level
|
|
break;
|
|
case 2 :
|
|
createPaintLevel(); // Allows users to draw and save their doodle
|
|
break;
|
|
case 3 :
|
|
createLEDLevel(); // Allows users t select and save their led sequence
|
|
break;
|
|
default :
|
|
startSession = 5; // doodle
|
|
break;
|
|
}
|
|
}
|
|
*/
|
|
|
|
/* Two buttons for user to select what type of level to create */
|
|
/*
|
|
void initLevelDeveloper() {
|
|
storedColor.clear();
|
|
storedXCoord.clear();
|
|
storedYCoord.clear();
|
|
storedPenWidth.clear();
|
|
storedLED.clear();
|
|
|
|
strokeWeight(2);
|
|
stroke(50);
|
|
|
|
// LED level
|
|
fill(180);
|
|
ellipse((displayWidth - menu.width)/2 - sizeButton*3, displayHeight/2 - sizeButton, sizeButton*2, sizeButton*2);
|
|
fill(50);
|
|
textSize(24);
|
|
text("LED",(displayWidth - menu.width)/2 - sizeButton*2.5, displayHeight/2 + 5);
|
|
|
|
// Paint Level
|
|
fill(180);
|
|
ellipse((displayWidth - menu.width)/2 + sizeButton, displayHeight/2 - sizeButton, sizeButton*2, sizeButton*2);
|
|
fill(50);
|
|
textSize(24);
|
|
text("Paint",(displayWidth - menu.width)/2 + sizeButton*1.5, displayHeight/2 + 5);
|
|
}
|
|
*/
|
|
|
|
/* Button to indicate level creation is ifnished */
|
|
/*
|
|
void finishButton() {
|
|
fill(180);
|
|
ellipse((displayWidth - menu.width) - sizeButton - 5, 5, sizeButton, sizeButton);
|
|
fill(50);
|
|
textSize(18);
|
|
text("Finish", (displayWidth-menu.width) - sizeButton , sizeButton/2 + 10);
|
|
}
|
|
*/
|
|
|
|
/* Loads appropriate precreated level */
|
|
/*
|
|
void loadButton() {
|
|
fill(180);
|
|
ellipse((displayWidth - menu.width) - sizeButton - 5, displayHeight - sizeButton*2 , sizeButton, sizeButton);
|
|
fill(50);
|
|
textSize(18);
|
|
text("Load", (displayWidth - menu.width) - sizeButton, displayHeight - sizeButton * 1.5 + 5);
|
|
}
|
|
*/
|
|
|
|
/* Reset used variables */
|
|
/*
|
|
void finishDeveloper() {
|
|
clearDisplay();
|
|
startSession = 5;
|
|
levelSession = 1;
|
|
}
|
|
*/
|
|
|
|
/* Clears containers for new use only one level can be stored at a time */
|
|
/*
|
|
void createPaintLevel() {
|
|
initPaint();
|
|
}
|
|
*/
|
|
/* Clears containers for new use only one level can be stored at a time */
|
|
/*
|
|
void createLEDLevel() {
|
|
initLed();
|
|
}
|
|
*/
|