can't get this program to work.

/*
Ultrasonic Backup Sensor
By

Summary:
This program was intended for an automobile backup sensor and takes reeadings from a
PING))) ultrasonic sensor and alerts you to an objects distance in four ways:
-Numeric readout
-Color coded zones
-Bar graph
-Audible tone
*/

//--------------------- include the library code: ---------------------------

#include <LiquidCrystal.h>
#include <Ping.h>

//--------------------------- Initialize --------------------------------------

LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
Ping ping = Ping(13,0,0);
float In = 0;
int green = 2;
int yellow = 3;
int red = 4;
float low = 72; //Set distance for warnings to start
int med = 0;
int high = 0;
int Inb = 0;
float space =0;
int flash = 0;
char* unit={“Feet”, “INCHES”};
int u = 1;

//Special Characters for Bar Graph
byte line[8] = {
B11111,
B00000,
B00000,
B00000,
B00000,
B00000,
B00000,
B11111
};
byte block[8] = {
B11111,
B11111,
B11111,
B11111,
B11111,
B11111,
B11111,
B11111
};
byte car[8] = {
B11111,
B01100,
B11110,
B00111,
B00111,
B11110,
B01100,
B11111
};
byte car1[8] = {
B11111,
B00110,
B11111,
B11000,
B11000,
B11111,
B00110,
B11111
};

//----------------------------- Setup -------------------------------------

void setup() {
lcd.begin(16, 2);
pinMode(6, OUTPUT);
pinMode(green, OUTPUT);
pinMode(yellow, OUTPUT);
pinMode(red, OUTPUT);
lcd.createChar(0, line);
lcd.createChar(1, block);
lcd.createChar(2, car1);
lcd.createChar(3, car);
med = (low/3)*2; // This breaks your warning distance into three even zones
high = low/3; // meaning the program will automatically scale if you
// change the start of the first warning zone
}

//------------------------------ Loop -----------------------------------

void loop() {

ping.fire();
In = ping.inches();
Inb = In;
if(In > 12){ //If measurement is greater than 12 inches use feet
space = In/12;
u = 0;
}else{ //else use inches
space = In;
u = 1;
}
lcd.clear();

if(In < high){ // Is the object in the Red Zone?
redLight();
distance();
bar();
}
else if ((In >= high) && (In < med)){ // Is the object in the Yellow Zone?
yellowLight();
distance();
bar();
}
else if ((In >= med) && (In < low)){ // Is the object in the Green Zone?
greenLight();
distance();
bar();
}
else if (In > low){ // If no object are in the set range print Drive Safely
lcd.setCursor(5, 0);
lcd.print(“Drive”);
lcd.setCursor(5, 1);
lcd.print(“Safely”);
noTone(6); //Tone and lights off
digitalWrite(red, LOW);
digitalWrite(yellow, LOW);
digitalWrite(green, LOW);
}

delay(200);

}

//---------------------- Red Zone ----------------------------

void redLight(){
tone(6,1440);
digitalWrite(green, HIGH);
digitalWrite(yellow, HIGH);
digitalWrite(red, HIGH);
}

//--------------------- Yellow Zone ----------------------------

void yellowLight(){
tone(6,880);
digitalWrite(green, HIGH);
digitalWrite(yellow, HIGH);
digitalWrite(red, LOW);
}

//-------------------- Green Zone ----------------------------

void greenLight(){
tone(6,440);
digitalWrite(green, HIGH);
digitalWrite(red, LOW);
digitalWrite(yellow, LOW);
}

//------------------- Print Distance -----------------------

void distance(){
lcd.setCursor(0, 0);
lcd.print("Distance: ");
lcd.setCursor(10, 0);
lcd.print(space);
lcd.setCursor(10, 1);
lcd.print(unit);
}
//--------------------- Bar Graph ---------------------------
void bar(){
if (Inb >= ((double)5/(double)6*low)){ //Farthest Away
lcd.setCursor(0,1);
lcd.write(2);
lcd.write(3);
lcd.write(0);
lcd.write(0);
lcd.write(0);
lcd.write(0);
lcd.write(0);
lcd.write(1);
}
else if ((Inb < ((double)5/(double)6low)) && (Inb >= ((double)4/(double)6low))){
lcd.setCursor(0,1);
lcd.write(0);
lcd.write(2);
lcd.write(3);
lcd.write(0);
lcd.write(0);
lcd.write(0);
lcd.write(0);
lcd.write(1);
}
else if ((Inb < ((double)4/(double)6low)) && (Inb >= ((double)3/(double)6low))){
lcd.setCursor(0,1);
lcd.write(0);
lcd.write(0);
lcd.write(2);
lcd.write(3);
lcd.write(0);
lcd.write(0);
lcd.write(0);
lcd.write(1);
}
else if ((Inb < ((double)3/(double)6low)) && (Inb >= ((double)2/(double)6low))){
lcd.setCursor(0,1);
lcd.write(0);
lcd.write(0);
lcd.write(0);
lcd.write(2);
lcd.write(3);
lcd.write(0);
lcd.write(0);
lcd.write(1);
}
else if ((Inb < ((double)2/(double)6low)) && (Inb >= ((double)1/(double)6low))){
lcd.setCursor(0,1);
lcd.write(0);
lcd.write(0);
lcd.write(0);
lcd.write(0);
lcd.write(2);
lcd.write(3);
lcd.write(0);
lcd.write(1);
}
else if (Inb < ((double)1 / (double)6 * low)){ //Closest also makes the graph flash
if (flash < 1){
flash = flash++;
lcd.setCursor(0,1);
lcd.write(0);
lcd.write(0);
lcd.write(0);
lcd.write(0);
lcd.write(0);
lcd.write(2);
lcd.write(3);
lcd.write(1);
tone(6, 2000);
}
else{
flash = 0;
lcd.setCursor(0,1);
lcd.write(0);
lcd.write(0);
lcd.write(0);
lcd.write(0);
lcd.write(0);
lcd.write(0);
lcd.write(0);
lcd.write(1);
tone(6, 2000);
}
}
}
THE PROGRAM IS FOR CAR REVERSE PARKING. I HAVE TRIED ALL I CAN BUT IT DOES NOT WORK.

You really should have read the How to use this forum - please read post at the top of the index page and How to use this forum before posting.

ie Your code and any error messages should always be placed between code tags. Posting it inline as you have done makes it much harder to read or copy and paste for diagnosis.

It's still not too late to edit your post and do this. You'll make potential helpers much happier. :) (It will also avoid all of the underlines that happened as a result of posting code inline.)

Edit: And once you've done that, a bit more info would be good if you really want help, rather than simply saying "can't get this program to work."

We aren't mind-readers.

Edit: Also, double-posting is bad:- need assistanve in implementing this car reverse car code

@oris, do not cross-post. Other thread removed.

To support @OldSteve, I won't look at that code until it is put between code tags and I can easily copy it to a text editor.

...R

There's near-identical post to this from January 2014 :o in Product Design

Robin2: To support @OldSteve, I won't look at that code until it is put between code tags and I can easily copy it to a text editor. ...R

Thanks Robin. I'm so tired of typing the suggestion to use code tags that I now keep it in a text file, then copy and paste into new posts as needed. :D

 if(In > 12){           //If measurement is greater than 12 inches use feet
    space = In/12;
    u = 0;
  }else{                 //else use inches
    space = In;
    u = 1;
  }

The rest of the code never looks at u. SO how will it know if you're talking about inches or feet? That's not a smart thing to do. Pick a unit and stick with it. Computers aren't like people. They're perfectly happy working with inches greater than 12 and not needing to convert to feet to figure out how far it is.

Delta_G: if(In > 12){          //If measurement is greater than 12 inches use feet     space = In/12;     u = 0;   }else{                //else use inches     space = In;     u = 1;   }

The rest of the code never looks at u. SO how will it know if you're talking about inches or feet? That's not a smart thing to do. Pick a unit and stick with it. Computers aren't like people. They're perfectly happy working with inches greater than 12 and not needing to convert to feet to figure out how far it is.

The underlining is because u is used as a subscript

Yeah, but only when he prints the unit.

lcd.print(unit[u]);

How about this line?

  if(In < high){       // Is the object in the Red Zone?
    redLight();
    distance();
    bar();
   }

You would always be in the red zone. Red zone is defined as less than 24. But is it inches or feet? Any measurement that big would be divided by 12 and turned into feet, so no measurement less than 24 feet could ever be greater than high and get you out of the red zone. Is a ping sensor even good for distance of 24 feet?