Ardunio 1.0.1 problems

I have a module called a colorPAL from parallax, basically a color sensor. It works great with Arduino .0023 but with Ardunio 1.0.0 or higher the code does not work, the sensor does not go on either.

here is the code

/*============================
========================
 / Connect ColorPAL SIG signal to Arduino pin 2 and 3
 / Add 2K pullup resistor from pins 2 & 3 to +5v
 / Baud Rate = 9600 kbps
 / Read signal on 9600 in HEX
 /====================================================*/

#include <SoftwareSerial.h>
SoftwareSerial Color90(2, 3);  // rx = 2, tx = 3

 int pin1 = 6;
   int pin2 = 9;
    int pin3 = 10;
int red;
int grn;
int blu;
float redCorr;
float bluCorr;
float grnCorr;
int gotcolor = 0;
int letter;

void setup()
{
   pinMode(pin1,OUTPUT);
 pinMode(pin2,OUTPUT);
 pinMode(pin3,OUTPUT);
  Serial.begin(9600); // Start communication with serial port read value
  Color90.begin(4800); // Send signal to led to read value

  pinMode(2,INPUT); // serial pin out from color pal
  pinMode(3,INPUT); // from same serial pin, signal pulls up, sends, pulls down, reads
  digitalWrite(2,HIGH); // Enable the pull-up resistor
  digitalWrite(3,HIGH); // Enable the pull-up resistor

  pinMode(2,OUTPUT); // send signal out
  pinMode(3,OUTPUT);
  digitalWrite(2,LOW); // turn pin off so pin 3 can go high
  digitalWrite(3,LOW);

  pinMode(2,INPUT); // Input signal to print
  pinMode(3,INPUT);

  Serial.println("Pass 1");
//  delay(20);

  while( digitalRead(2) != HIGH || digitalRead(3) != HIGH ) {
    Serial.println("In the loop");
    delay(50);
  }

  Serial.println("Pass 2");

  pinMode(2,OUTPUT);
  pinMode(3,OUTPUT);
  digitalWrite(2,LOW);
  digitalWrite(3,LOW);
  delay(100);     // spec is 80, but not all ColorPAL units work with 80

  pinMode(2,INPUT);
  pinMode(3,OUTPUT);
  delay(100);

}

// This oscillates back and forth on one wire to turn off led, send signal,
// turn on led, read signal. very fast strobe read - arduino is not capable of
// one wire signal communication over digital ports, so this is a way around
// that over 2 wires communicating with 1 pin on the sensor.
//---------------------------------

void loop()
{
  readcolor();

  gotcolor = 0;
  delay(100);

}
void readcolor() {  // Reads ColorPAL, putting results in the red,grn,blu variables

  char rByte[9];
  char dummy[4];

  delay(20);
  Color90.begin(4800);
 Color90.print("= (00 $ m) !");  // set up loop to continuously send color data
  pinMode(3,INPUT);
  gotcolor = 0;
  while (gotcolor == 0) {
    rByte[0] = Color90.read();
    if( rByte[0] == '

) {
      gotcolor = 1;
      for(int i=0; i<9; i++) {
        rByte[i] = Color90.read();
//        Serial.print(rByte[i]);
      }
      Serial.println("");
      dummy[0] = rByte[0];
      dummy[1] = rByte[1];
      dummy[2] = rByte[2];
      dummy[3] = 0;

red = strtol(dummy,NULL,16);

dummy[0] = rByte[3];
      dummy[1] = rByte[4];
      dummy[2] = rByte[5];

grn = strtol(dummy,NULL,16);
   
   
      dummy[0] = rByte[6];
      dummy[1] = rByte[7];
      dummy[2] = rByte[8];

blu = strtol(dummy,NULL,16);
   
      bluCorr= (((float)blu-37.)/(505.-37.));
      grnCorr= (((float)grn-20.)/(271.-20.));
      redCorr= (((float)red-24.)/(304.-24.));

}
  }
  Serial.print(blu);
  Serial.println();
  Serial.print(grn);
    Serial.println();
    Serial.print(red);
      Serial.println();
      tone(pin1,300+grn,100);

}

but with Ardunio 1.0.0 or higher the code does not work

Wrong. The code works. It just not achieve your desired results. What it does, and what you expect it to do, are not the same thing, obviously. What either one is, though, is a mystery. Perhaps Columbo will be along soon, to clear that up.

In all seriousness, is that the SAME code that you were using on 0023? If so, be aware that SoftwareSerial from 0023 and SoftwareSerial from 1.0+ are NOT the same code.

You have Serial.print() statements. What do they tell you?

 int pin1 = 6;
   int pin2 = 9;
    int pin3 = 10;

Please come up with better names than this. What is connected to these pins? That should give you a clue what the names should be. Perhaps, given some of your other names, redPin, grnPin, and bluPin?

  pinMode(2,OUTPUT); // send signal out
  pinMode(3,OUTPUT);
  digitalWrite(2,LOW); // turn pin off so pin 3 can go high
  digitalWrite(3,LOW);

  pinMode(2,INPUT); // Input signal to print
  pinMode(3,INPUT);

You told SoftwareSerial that these were its pins. Why are you diddling with them? Do you want them to be input or output? Make up your mind. Or better yet, delete all this.

    rByte[0] = Color90.read();

Nary a call to Color90.available() in sight. Just assume that all the data is there as fast as you can read it. At 4800 baud, that's a lousy assumption.

It is the same code I used from .0023.
I did not write this code my self I found it here. Circuitry + Arduino + Us = Medical Devices: Our Code for Using ColorPal

How are the software serial functions different?
my only guess is one of the functions is outdated because the program freezes in the while loop.

I noticed the following:

  pinMode(2,INPUT); // serial pin out from color pal
  pinMode(3,INPUT); // from same serial pin, signal pulls up, sends, pulls down, reads
  digitalWrite(2,HIGH); // Enable the pull-up resistor
  digitalWrite(3,HIGH); // Enable the pull-up resistor

Now right now, I'm stuck on 0.23 of the IDE because I'm using Fedora 14 (Fedora 15's gnome3 doesn't like older video cards like I have in my laptop). However, I've seen other posts that in 1.0 they changed how you setup pull-up resistors. Evidently in 1.0, the old method still worked, but I think it doesn't work 1.0.1. The recommended fix was to mark the pin as INPUT_PULLUP directly. If you have to work on both old and new IDE's, then you need an #ifdef for conditional compilation:

#if defined(ARDUINO) && ARDUINO >= 100
    pinMode (2, INPUT_PULLUP);
    pinMode (3, INPUT_PULLUP);

#else
    // Pull up method for 0.21
    pinMode (2, INPUT);
    pinMode (3, INPUT);
    digitalWrite (2, HIGH);
    digitalWrite (3, HIGH);
#endif

my only guess is one of the functions is outdated

The one that came with 0023 and earlier was. Everyone recommended the use of NewSoftSerial, instead, which became SoftwareSerial with 1.0.