Check my code plz?

hi. everytime i try to compile this in arduino IDE the programe crashes.

can someone help? <www.mitchellpage.com.au/wireless1.zip

//PROCESSING TO WIRING VERSION 4

char val;             // variable to receive data from the serial port
int led = 0;          // variable that keeps which led must be turn on next 
int ledpinFour = 2;    
int ledpinFive = 3;
int ledpinFour = 4;    
int ledpinFive = 6;
int ledpinFour = 5;    
int ledpinFive = 6;   
int ledpinSix = 7;  
int ledpinSeven = 8;    
int ledpinEight = 9;   
int ledpinNine = 10;  

int viz2_state = 0;
int viz3_state = 0;

int vizOneActive;
int vizTwoActive;
int vizThreeActive;

void setup() 
{
pinMode(ledpinOne, OUTPUT);
  pinMode(ledpinTwo, OUTPUT);  
  pinMode(ledpinThree, OUTPUT);
  pinMode(ledpinFour, OUTPUT);
  pinMode(ledpinFive, OUTPUT);  
  pinMode(ledpinSix, OUTPUT);
  pinMode(ledpinSeven, OUTPUT);
  pinMode(ledpinEight, OUTPUT);  
  pinMode(ledpinNine, OUTPUT);
  beginSerial(9600);       // start serial communication at 9600bps
}


void loop() {

  if ( serialAvailable() > 0)       // if data is available to read
  {
    val = serialRead();        // read it and store it in 'val'   
  }
  analogWrite(0, val);

  //CHECK WHICH VALUE IS SENT
  if( val == 'A' ){           //turn viz 1 on
    vizOneActive = 1;
  } 
  if ( val == 'B' ){          //turn viz 2 on
    vizTwoActive = 1;
  }
  if ( val == 'C'){           //turn viz 3 on
    vizThreeActive = 1;
  }
  if( val == 'D' ){           //turn viz 1 off
    vizOneActive = 0;
  } 
  if ( val == 'E' ){          //turn viz 2 off
    vizTwoActive = 0; 
  }
  if ( val == 'F'){           //turn viz 3 off
    vizThreeActive = 0; 
  }
  if ( val == 'G'){           //turn all vizualizations off
    vizOneActive = 0;
    vizTwoActive = 0;
    vizThreeActive = 0;
    turn_all_off();
  }

  //IF STATES ARE ON
  if (vizOneActive == 1){
    ledVizOne();
  }
  if (vizTwoActive == 1){
    ledVizTwo();
  }
  if (vizThreeActive == 1){
    ledVizThree();
  }

  //IF STATES ARE OFF
  if (vizOneActive == 0){
    turn_vizOne_off(); 
  } 
  if (vizTwoActive == 0){
    turn_vizTwo_off();
  }
  if (vizThreeActive == 0){
    turn_vizThree_off();
  }
  delay(200);

}


/*=======================
 
 VISUALIZATION FUNCTIONS
 
 =======================*/

//VISUALIZATION 1     
//function to continually turning on and off led's in cycle  
void ledVizOne(){                                  
  turn_vizOne_off();
  digitalWrite(led, HIGH);      
  led = (led + 1) % 3;
}

//VISUALIZATION 2
//function to turn all led's off in blinking fashion
void ledVizTwo(){
  if (viz2_state == 0) {
    turn_vizTwo_on();
    viz2_state = 1;
  } 
  else {
    turn_vizTwo_off();
    viz2_state = 0;
  }
}

//VISUALIZATION 3
//function to turn leds off/on from outside in
void ledVizThree() {
  turn_vizThree_off();

  if (viz3_state == 0) {
    digitalWrite(ledpinSeven, HIGH);
    digitalWrite(ledpinNine, HIGH);
    digitalWrite(ledpinEight, LOW);
    viz3_state = 1;

  } 
  else {
    digitalWrite(ledpinSeven, LOW);
    digitalWrite(ledpinNine, LOW);
    digitalWrite(ledpinEight, HIGH);
    viz3_state = 0;
  }
}


/*=======================
 OTHER FUNCTIONS
 =======================*/

//function to turn OFF all the lights connected to digital pins 0 to 2 
void turn_vizOne_off()            
{                              
  int i; 
  for(i=0; i<3; i++) 
  { 
    digitalWrite(i, LOW); 
  } 
}
//function to turn OFF all the lights connected to digital pins 8 to 10 
void turn_vizTwo_off()            
{                              
  int i; 
  for(i=8; i<11; i++) 
  { 
    digitalWrite(i, LOW); 
  } 
}
// function to turn ON all the lights connected to digital pins 8 to 10 
void turn_vizTwo_on()            
{                              
  int i; 
  for(i=8; i<11; i++) 
  { 
    digitalWrite(i, HIGH); 
  } 
}
//function to turn OFF all the lights connected to digital pins 16 to 18 
void turn_vizThree_off()            
{                              
  int i;
  for(i=16; i<19; i++) 
  { 
    digitalWrite(i, LOW); 
  } 
}
//function to turn OFF all the lights connected to digital pins 0 to 18 
void turn_all_off()            
{                              

  int i; 
  for(i=0; i<19; i++) 
  { 
    digitalWrite(i, LOW); 
  } 
   
}

sorry i can’t cut and past your code to test.
in the source code of the html page, it’s not in utf8, all with uggly “);”
a link to download ?

and what is suppose to do (to save some minutes to understand your code)

regards

eric

Sorry, didnt realise.

i have attached a link to download the .pde file. <www.mitchellpage.com.au/wireless1.zip

basically, this i have 9 LEDs aranged in clusters of 3. each cluster performs a seperate visualization (series of on/off blinking).

i have 3 pairs of on/off buttons in processing. basically i install the code onto arduino and run when connected to my computer, i should be able to turn the clusters (visualizationOne, visualizationTwo and visualizationThree) on and off by pressing buttons in processing which send commands (A,B,C …etc) to arduino

Please help. Thanks!

i have had a similar programming working with Wiring but i have made the jump to arduino - but its not working for me!

The first problem is that you’re declaring variables twice:

int ledpinFour = 2;    
int ledpinFive = 3;
int ledpinFour = 4;    
int ledpinFive = 6;
int ledpinFour = 5;    
int ledpinFive = 6;

You can only have one called “ledpinFour” or “ledpinFive”.

The error “conflicting types for ledVizOne” is because you need a function prototype at the top of your code. (This won’t be necessary in Arduino 0004). That is, you’ll need something like this:

void ledVizOne();

for each of your functions.

Hey thanks Man :smiley:

Code compiles now!!!

Cheers!