Problem in compiling.Large no of erros.HELP to solving it.

Hello Friends,
:roll_eyes: As i am new can't understand any logic of Program from some one i got the following Codes but i could not able to decode it.So Plz plz Help me.Thanks in advance and plz place comments in every lines.And give me some troubleshooting....

int   val = 3;                                         
long  last = 100;                                       
int   stat = HIGH;
int   stat2;
int   contar;
int   displayrpm;                                       
int   sens = 75;                                        
int   nPalas = 1;
int   milliseconds = 1000;                                

float speed = A0;                                        
float volt  = A1;                                        
float motorpin = 9;                                     
int chargeingpin = 12;                                  
int brack = 2;          
int buttonbrack;

int brackindicator = 13;

void   setup()
{
 pinMode(volt, INPUT);
 pinMode(brack, INPUT);
 pinMode(chargeingpin, OUTPUT);
 pinMode(motorpin, OUTPUT);
 pinMode(brackindicator, OUTPUT);
 
 Serial.begin(9600);                                   
}



void   loop()





{
 val = analogRead(3);                                  
 if (val < sens)
   stat = LOW;
 else
   stat = HIGH;
 if (stat2 != stat)                                 
 {
  contar++;
 stat2 = stat; 
}


 if(millis() - last >= milliseconds)                 
 {
   double rpm = (2.0 * 60000.0 /(milliseconds));      
   displayrpm = rpm;
   
   LCDPrint();
 }
}


void   LCDPrint();
{
 lcd.clear();               // Start with a blank screen
 lcd.setCursor (0, 0);      // Set the cursor to the beginning
 lcd.print("MPH = ");
 lcd.print(mph);
 lcd.setCursor (0,2);      // Set the cursor to the SECOND ROW
 lcd.print("KMP = ");
 lcd.print(kph);
 

 
   
 buttonbrack = digitalRead();                               
 if (buttonbrack == HIGH)                                  
 {
   digitalWrite (motorpin,LOW);
   
   speed = analogRead(A0);                                 
   speed = speed ;
   
   analogWrite (motorpin,speed);
   /*auto accleleration */
   
   
   float volt = analogRead(A1);
   volt = volt *.00463000000;
   Serial.println(volt);                                  
   Serial.println("V");
   
   
   if (volt < 3.3){
     digitalWrite(chargeingpin,HIGH);                  
     Serial.print("CHARGING ON");
   }
   if (volt > 4.5){
       digitalWrite(chargeingpin,LOW);                 
     Serial.print("CHARGING OFF");
   }
   else{
   }
delay(1000);
 }
 return;
}

We can read that code and see what it does. It does it very well.

What do you want it to do? What is it doing that you don't want and what is it not doing that you do want?

Hi,

First you have to learn how to use code tags for this forum.

void  LCDPrint();// no semi colons here like this

This is also one of the mistakes in your code.

Also, on your arduino IDE, use auto format.

Thank you.

from some one i got the following Codes

plz place comments in every lines

And give me some troubleshooting....

What are you going to do, just out of curiosity? Nothing?

Code tags tutor:

[code]...[/code]

autoformat:
use CTRL-T in the IDE
or from menu.

empty else can be omitted

else{
}

His job is to find people who happily will do his job.

Reminds me to "Tom Sawyer" by Mark Twain when Tom was given the task of painting a fence.

 speed = speed ;

That should do the trick. :slight_smile:

aarg, you forgot the comment for that line.

speed = speed ; // keep speed up to date with the real speed ?

    float volt = analogRead(A1);
    volt = volt *.00463000000;

Do you really think that all those 0s on the end add value? How many digits of precision in a float?

float speed = A0;                                       
float volt  = A1;              
...
speed = analogRead(A0);                                 
speed = speed ;
...
 float volt = analogRead(A1);
 volt = volt *.00463000000;

Well, I'm confused about what these variables are for.

Well, I'm confused about what these variables are for.

So was whoever wrote that crap.

hey thanks to everyone for replying me.let me tell you that i am just a student,and i got this program from my teacher who helped me to make my final year project.but i am not much familiar with all this kind of coding and programming i could not able to make it error freeeeeee.so in my project i used following things

1.lcd 20*4 >> displays mph and kph
2.hall effect sensor for sensing rpm.
3.brakebuttons used to not to start the dc motor.
4.auto acceleration concept may be covered in above program.

in above program all this things included.....i request some one to plz help me....to make it error freeeeeee


Moderator edit: Converted entire post from all caps to all lower-case. (Nick Gammon)

Turn off the Caps Lock vipulsinh, that's like shouting here. Very rude.

Please edit your post, select the code, and put it between [code] ... [/code] tags.

You can do that by hitting the "Code" button above the posting area (It looks like a scroll with < > inside it).

How to use this forum

vipulsinh:
plz place comments in every lines.

Sure! No Problemo!

int val = 3; // defines a val variable with a width of 3
long last = 100; // ensures that the last val is 3-100 = -97
int stat = HIGH; // includes the statistics package, high priority
int stat2; // includes the second statistics package
int contar; // reverses the motor
int displayrpm; // this is a bug - it should say 'delayrpm'
int sens = 75; // senses a 75
int nPalas = 1; // (not sure what thi is - sorry)
int milliseconds = 1000; // there are 1000 miliseconds in an RPM

Whew! I'm all expained out. Does anyone else want to keep going? I don't have a degree, so the more people like this that pass their courses and get a peice of paper to wave around, the better.

PaulMurrayCbr:
Sure! No Problemo!

int val = 3; // defines a val variable with a width of 3
long last = 100; // ensures that the last val is 3-100 = -97
int stat = HIGH; // includes the statistics package, high priority
int stat2; // includes the second statistics package
int contar; // reverses the motor
int displayrpm; // this is a bug - it should say 'delayrpm'
int sens = 75; // senses a 75
int nPalas = 1; // (not sure what thi is - sorry)
int milliseconds = 1000; // there are 1000 miliseconds in an RPM

Whew! I'm all expained out. Does anyone else want to keep going? I don't have a degree, so the more people like this that pass their courses and get a peice of paper to wave around, the better.

hey man thanks for sharing your valuable knowledge........

MorganS:
We can read that code and see what it does. It does it very well.

What do you want it to do? What is it doing that you don't want and what is it not doing that you do want?

jurs:
His job is to find people who happily will do his job.

Reminds me to "Tom Sawyer" by Mark Twain when Tom was given the task of painting a fence.
[/q

Delta_G:
Or in other words...

Please do my homework for me because I'm lazy and I want this degree even though I'm not willing to learn what I need to know to get it. Hopefully when I go for a new job they won't find out that I don't know what I'm doing.

this is not a Home work for me. I just want some helps to deocode this program....

Large no of erros.

What errors?

Here my errors...

Arduino: 1.6.1 (Windows 7)

HEART.ino: In function 'void loop()':

HEART.ino:63:3: error: expected ';' before '}' token

HEART.ino: In function 'void LCDPrint()':

HEART.ino:69:3: error: 'lcd' was not declared in this scope

HEART.ino:72:13: error: 'MPH' was not declared in this scope

HEART.ino:75:13: error: 'KMP' was not declared in this scope

HEART.ino:81:29: error: too few arguments to function 'int digitalRead(uint8_t)'

In file included from HEART.ino:6:0:

C:\Program Files\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:127:5: note: declared here

int digitalRead(uint8_t);

^

Error compiling.

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.