We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › compilation errors
Poll Poll
Question: Compilation errors



« Created by: venkata on: Apr 9th, 2009, 4:22pm »

Page Index Toggle Pages: 1
compilation errors (Read 479 times)
compilation errors
Apr 9th, 2009, 4:22pm
 
Hello every one , iam new to this processing. Can any one please let me know about errors in my program below

class Not {
 Not connectedTo;

 Not() {
   //setup
    setup(){
 size(500,500);
    }
void mouseReleased() {
 //toggle the input state
 inputvalue = !inputvalue;
 //checkvalue=inputvalue;
}
 }

 void connectMeTo(Not cn) {
   connectedTo = cn;
 }

 //to match the example
 void update() {
   //check the output of connectedTo
    checkvalue = inpputvalue;
   
   //change state based on that
   inputvalue= !inputvalue;
   //draw stuff
   void draw() {
 background(255);

 noFill();
 rect(20,20,40,40);
 a= loadImage("nanotube1.jpg"); // load image
 
 if (inputvalue) {
   //Z shape
   line(20,30,50,30);
  //image(a,20,30);
   line(30,50,60,50);
   line(50,30,30,50);
 } else {
   //draw default state
   line(10,30,40,30);
  // image(a,10,30);
   line(40,50,70,50);
   line(40,30,40,50);
 }  
 
}  



Re: compilation errors
Reply #1 - Apr 9th, 2009, 4:37pm
 
My task is to develop a logical NOT gate that will look like a Z shape if mouse is pressed at one end it takes it as input "1" and bottom leg moves inside. I have developed the following code for this as below Huh

boolean inputvalue = false;//store the input state
PImage a;
PImage b;
PImage c;

void setup() {
 size(500,500);
 
 
}

void mouseReleased() {
 //toggle the input state
 inputvalue = !inputvalue;
}
void draw() {
 background(255);

 noFill();
 rect(20,20,40,40);
 a= loadImage("nanotube1.jpg"); // load image
 
 if (inputvalue) {
   //Z shape
   line(20,30,50,30);
  //image(a,20,30);
   line(30,50,60,50);
   line(50,30,30,50);
 } else {
   //draw default state
   line(10,30,40,30);
   //image(a,10,30);
   line(40,50,70,50);
   line(40,30,40,50);
 }  
 
}  

/* void draw() {
 background(255);

 if (inputvalue) {
   //draw the second line
   line(140,230,290,230);
 } else {
   //draw the normal line
   line(20,230,160,230);  
 }  */



Now My task is to make it inside a class and to see if there is a way to connect the output
of one to the input of another without having to actually
create the code for more than one.

Can anybody please help me out
Re: compilation errors
Reply #2 - Apr 9th, 2009, 5:05pm
 
what is this poll for? dont get it
Page Index Toggle Pages: 1