// This began as... // Spring // by REAS // and became... // testMOD97 // which sprouted into adressing03 // mangled by oz // Hey, if this mess of code works, think what a decent programmer could do! // Thanks to Team Processing for a great language // Latest revision: 04 Aug 04 // a demonstration of address selectrion and decoding // as background history for The RCA Selectron digital memory tube boolean writeok = true; // OK to initiate write pulse boolean over10 = false; // If mouse over boolean over11 = false; // If mouse over boolean over20 = false; // If mouse over boolean over21 = false; // If mouse over boolean over30 = false; // If mouse over boolean over31 = false; // If mouse over boolean pin10 = false; // selecting bar polarity boolean pin11 = false; // selecting bar polarity boolean pin20 = false; // selecting bar polarity boolean pin21 = false; // selecting bar polarity boolean pin30 = false; // selecting bar polarity boolean move = false; // If mouse down and over int size = 5; // Width of the shape int xpos = 75; // Position of electrons int xpos2 = 0; // Position of electrons int xpos3 = 0; // Position of electrons int xpos5 = 0; // Position of electrons int xpos6 = 0; // Position of electrons int xpos8 = 0; // Position of electrons int xpos9 = 0; // Position of electrons int ypos1 = 60; // Position of electrons int ypos2 = 60; // Position of electrons int ypos3 = 60; // Position of electrons int ypos4 = 60; // Position of electrons int ypos5 = 60; // Position of electrons int ypos6 = 60; // Position of electrons int ypos7 = 60; // Position of electrons int ypos8 = 60; // Position of electrons int ypos9 = 60; // Position of electrons int ypos10 = 60; // Position of electrons int yspeed1 = 5; // Speed of the electrons int ydirection1 = 1; // Top to Bottom int ydirection2 = 1; // Top to Bottom int ydirection3 = 1; // Top to Bottom int ydirection4 = 1; // Top to Bottom int ydirection5 = 1; // Top to Bottom int ydirection6 = 1; // Top to Bottom int ydirection7 = 1; // Top to Bottom int ydirection8 = 1; // Top to Bottom int ydirection9 = 1; // Top to Bottom int ydirection10 = 1; // Top to Bottom int drift1 = 0; // Deflected electron lateral movement int drift2 = 0; // Deflected electron lateral movement int drift3 = 0; // Deflected electron lateral movement int drift4 = 0; // Deflected electron lateral movement int drift5 = 0; // Deflected electron lateral movement int drift6 = 0; // Deflected electron lateral movement int drift7 = 0; // Deflected electron lateral movement int drift8 = 0; // Deflected electron lateral movement int drift9 = 0; // Deflected electron lateral movement int drift10 = 0; // Deflected electron lateral movement BFont metaItalic; // The font "Meta-Italic.vlw.gz" must be located in the // current sketch's "data" directory to load successfully void setup() { size(500, 380); rectMode(CORNERS); noStroke(); colorMode(RGB); metaItalic = loadFont("Meta-Italic.vlw.gz"); // No serifs, thanks textFont(metaItalic, 20); } void loop() { background(102); updateEyelet(); // border fill (0); rect (0,0,2,380); rect (0,0,500,2); rect (500,380,0,378); rect (500,380,498,0); // selection bars fill (100,100,200); if ( !pin10 ){ fill(200,100,100); } ellipse (103, 150, 20, 20); fill (255); text("-", 108,164); if ( !pin10 ){ fill(200,100,100); ellipse (103, 150, 20, 20); fill (255); text("+", 108,164); } fill (100,100,200); if ( !pin11 ){ fill(200,100,100); } ellipse (178, 150, 20, 20); fill (255); text("-", 183,164); if ( !pin11 ){ fill(200,100,100); ellipse (178, 150, 20, 20); fill (255); text("+", 183,164); } fill (100,100,200); if ( !pin20 ){ fill(200,100,100); } ellipse (253, 150, 20, 20); fill (255); text("-", 258,164); if ( !pin20 ){ fill(200,100,100); ellipse (253, 150, 20, 20); fill (255); text("+", 258,164); } fill (100,100,200); if ( !pin21 ){ fill(200,100,100); } ellipse (328, 150, 20, 20); fill (255); text("-", 333,164); if ( !pin21 ){ fill(200,100,100); ellipse (328, 150, 20, 20); fill (255); text("+", 333,164); } // Text fill(255,255,255); text("Selective Addressing", 320, 373); text("Cathode", 380, 40); text("Selection", 380, 160); text("Electrodes", 380, 175); // Cathode fill(200,20,20); rect(100,20,355,40); // Electrons are blue...right? fill(20,200,200); // Update the position of the electron beam ypos1 = ypos1 + (yspeed1 * ydirection1); ypos2 = ypos2 + (yspeed1 * ydirection2); ypos3 = ypos3 + (yspeed1 * ydirection3); ypos4 = ypos4 + (yspeed1 * ydirection4); ypos5 = ypos5 + (yspeed1 * ydirection5); ypos6 = ypos6 + (yspeed1 * ydirection6); ypos7 = ypos7 + (yspeed1 * ydirection7); ypos8 = ypos8 + (yspeed1 * ydirection8); ypos9 = ypos9 + (yspeed1 * ydirection9); ypos10 = ypos10 + (yspeed1 * ydirection10); xpos2 = xpos2 + drift2; xpos3 = xpos3 + drift3; xpos5 = xpos5 + drift5; xpos6 = xpos6 + drift6; xpos8 = xpos8 + drift8; xpos9 = xpos9 + drift9; // repel if fully charged if ( ypos1 == 130 && pin10) { ydirection1 = -1; } if ( ypos2 == 130 && pin10 ) { ydirection2 = -1; drift2 = 1; } if ( ypos2 == 130 && (!pin10) ) { drift2 = - 3; } if (ypos2 == 130 && ( ((!pin10) && (!pin11)) || ((pin10) && (pin11)) ) ) { drift2 = 0; } if ( ypos3 == 130 && pin11 ) { ydirection3 = -1; drift3 = -1; } if ( ypos3 == 130 && (!pin11) ) { drift3 = + 3; } if (ypos3 == 130 && ( ((!pin10) && (!pin11)) || ((pin10) && (pin11)) ) ) { drift3 = 0; } if ( ypos4 == 130 && pin11 ) { ydirection4 = -1; } if ( ypos5 == 130 && pin11 ) { ydirection5 = -1; drift5 = 1; } if ( ypos5 == 130 && (!pin11) ) { drift5 = - 3; } if (ypos5 == 130 && ( ((!pin20) && (!pin11)) || ((pin20) && (pin11)) ) ) { drift5 = 0; } if ( ypos6 == 130 && pin20 ) { ydirection6 = -1; drift6 = -1; } if ( ypos6 == 130 && (!pin20) ) { drift6 = + 3; } if (ypos6 == 130 && ( ((!pin20) && (!pin11)) || ((pin20) && (pin11)) ) ) { drift6= 0; } if ( ypos7 == 130 && pin20) { ydirection7 = -1; } if ( ypos8 == 130 && pin20 ) { ydirection8 = -1; drift8 = 1; } if ( ypos8 == 130 && (!pin20) ) { drift8 = - 3; } if (ypos8 == 130 && ( ((!pin20) && (!pin21)) || ((pin20) && (pin21)) ) ) { drift8 = 0; } if ( ypos9 == 130 && pin21 ) { ydirection9 = -1; drift9 = -1; } if ( ypos9 == 130 && (!pin21) ) { drift9 = + 3; } if (ypos9 == 130 && ( ((!pin20) && (!pin21)) || ((pin20) && (pin21)) ) ) { drift9 = 0; } if ( ypos10 == 130 && pin21) { ydirection10 = -1; } //emit some electrons from the cathode, if none in play if ( ypos1 < 40 || ypos1 > 220) { ypos1 = 60; drift1 = 0; ydirection1 = 1; } if ( ypos2 < 40 || ypos2 > 220) { ypos2 = 60; xpos2 = 0; drift2 = 0; ydirection2 = 1; } if ( ypos3 < 40 || ypos3 > 220) { ypos3 = 60; xpos3 = 0; drift3 = 0; ydirection3 = 1; } if ( ypos4 < 40 || ypos4 > 220) { ypos4 = 60; drift4 = 0; ydirection4 = 1; } if ( ypos5 < 40 || ypos5 > 220) { ypos5 = 60; xpos5 = 0; drift5 = 0; ydirection5 = 1; } if ( ypos6 < 40 || ypos6 > 220) { ypos6 = 60; xpos6 = 0; drift6= 0; ydirection6 = 1; } if ( ypos7 < 40 || ypos7 > 220) { ypos7 = 60; drift7 = 0; ydirection7 = 1; } if ( ypos8 < 40 || ypos8 > 220) { ypos8 = 60; xpos8 = 0; drift8 = 0; ydirection8 = 1; } if ( ypos9 < 40 || ypos9 > 220) { ypos9 = 60; xpos9 = 0; drift9 = 0; ydirection9 = 1; } if ( ypos10 < 40 || ypos10 > 220) { ypos10 = 60; drift10 = 0; ydirection10 = 1; } // Draw the primary electrons fill(20,200,200); if ( ypos1 > 150) { fill(102); } ellipse( 110, ypos1, 5, 5); fill(20,200,200); if ( xpos2 < -15) { fill(102); } ellipse(( 135) + (xpos2), ypos2, 5, 5); fill(20,200,200); if ( xpos3 > 15) { fill(102); } ellipse(( 160) + (xpos3), ypos3, 5, 5); fill(20,200,200); if ( ypos4 > 150){ fill(102); } ellipse( 185 , ypos4, 5, 5); fill(20,200,200); if ( xpos5 < -15) { fill(102); } ellipse(( 210) + (xpos5), ypos5, 5, 5); fill(20,200,200); if ( xpos6 > 15) { fill(102); } ellipse(( 235) + (xpos6), ypos6, 5, 5); fill(20,200,200); if ( ypos7 > 150){ fill(102); } ellipse( 260 , ypos7, 5, 5); fill(20,200,200); if ( xpos8 < -15) { fill(102); } ellipse( 285 + (xpos8), ypos8, 5, 5); fill(20,200,200); if ( xpos9 > 15) { fill(102); } ellipse( 310 + (xpos9), ypos9, 5, 5); fill(20,200,200); if ( ypos10 > 150){ fill(102); } ellipse( 335, ypos10, 5, 5); } // Hey, this ain't FORTRAN ... there's no GOTO void updateEyelet() { // Test if mouse is over if( mouseY > 150 && mouseY < 170 && mouseX > 100 && mouseX < 120 ) { over10 = true; } else { over10 = false; } if( mouseY > 150 && mouseY < 170 && mouseX > 175 && mouseX < 195 ) { over11 = true; } else { over11 = false; } if( mouseY > 150 && mouseY < 170 && mouseX > 250 && mouseX < 270 ) { over20 = true; } else { over20 = false; } if( mouseY > 150 && mouseY < 170 && mouseX > 325 && mouseX < 345 ) { over21 = true; } else { over21 = false; } if( mouseY > 150 && mouseY < 170 && mouseX > 400 && mouseX < 420 ) { over30 = true; } else { over30 = false; } if( mouseY > 150 && mouseY < 170 && mouseX > 440 && mouseX < 460 ) { over31 = true; } else { over31 = false; } } void mousePressed() { if(over10) { pin10 = !pin10; } if(over11) { pin11 = !pin11; } if(over20) { pin20 = !pin20; } if(over21) { pin21 = !pin21; } if(over30) { pin30 = !pin30; } }