Go Down

Topic: Compiling Code error? (Read 551 times) previous topic - next topic

adam1997gipe

I'm programming my Arduino Uno R3 to create an digital tachometer. Whenever I try to upload a code I get an error message. At first I could upload a sample code, but now that I have a sample code uploaded, I can't even use a different sample code, or any one that I type. I am using Windows XP. My error code is

Error Compiling:
avr-g++: error: C:\DOCUME~1\ADAMS~1\LOCALS~1\Temp\build1776450898673946833.tmp\tachometer_code.cpp -o C:\DOCUME~1\ADAMS~1\LOCALS~1\Temp\build1776450898673946833.tmp\tachometer_code.cpp.o: No such file or directory
avr-g++: fatal error: no input files
compilation terminated.
Error compiling.

This is part of my senior project for high school graduation, so any help would be greatly appreciated, thanks!

Peter_n

#1
Mar 07, 2015, 01:35 am Last Edit: Mar 07, 2015, 01:36 am by Peter_n
Hi, welcome to the forum.

I don't know what is wrong.
Could you remove any installed Arduino, but keep your folder with your projects (your sketches) of course.
Unzip the Arduino IDE 1.6.0 in a folder in your home folder. Run Arduino from that folder.

If that is still a problem, perhaps there are old versions of Arduino somewhere, or the Java is not compatible.
Can you try it on another computer ?

RayLivingston

Start simple:  Can you compile and run the blink example?  If not, copy and paste the ENTIRE output window, so we can see ALL the messages.

Regards,
Ray L.

adam1997gipe

I guess I somehow fixed the problem with uploading the sample codes, but the code I am trying to use is still not uploading, but this time I have an error message. I don't see where I made my error, can you look it over for me quick?

#include <LiquidCrystal.h>

ShiftLCD lcd(8,10,9);    // DEFINE LCD PINS

volatile byte REV;       //  VOLATILE DATA TYPE TO STORE REVOLUTIONS
 
unsigned long int rpm, maxRPM;  //  DEFINE RPM AND MAXIMUM RPM
 
unsigned long time;         //  DEFINE TIME TAKEN TO COVER ONE REVOLUTION
 
int ledPin = 12;           //   STATUS LED
 
int led = 0,RPMlen , prevRPM;  //  INTEGERS TO STORE LED VALUE AND CURRENT RPM AND PREVIOUS RPM
 
int flag = 0;             //  A VARIABLE TO DETERMINE WHETHER THE LCD NEEDS TO BE CLEARED OR NOT

long prevtime = 0;       //  STORE IDLE TIME TO TOGGLE MENU
   
 void setup()
 {
     Serial.begin(9600);   // GET VALUES USING SERIAL MONITOR
     
     lcd.begin(16, 2);     // INITIATE LCD
     
     attachInterrupt(0, RPMCount, RISING);     //  ADD A HIGH PRIORITY ACTION ( AN INTERRUPT)  WHEN THE SENSOR GOES FROM LOW TO HIGH
     
     REV = 0;      //  START ALL THE VARIABLES FROM 0
     
     rpm = 0;
     
     time = 0;
     
     pinMode(ledPin, OUTPUT);
     
     pinMode(3, OUTPUT);           
     
     pinMode(4, OUTPUT);
     
     digitalWrite(3, HIGH);             //  VCC PIN FOR SENSOR
     
     digitalWrite(4, LOW);              // GND PIN FOR SENSOR
     
     lcd.print("TACHOMETER");           //   STARTUP TEXT
     lcd.setCursor(0, 1);
     lcd.print("- ELECTRO18");          //  THAT'S ME
     delay(2000);
     lcd.clear();
     
 }
 
 void loop()
 {
  long currtime = millis();                 // GET CURRENT TIME
 
  long idletime = currtime - prevtime;        //  CALCULATE IDLE TIME
   
    if(REV >= 5 )                  //  IT WILL UPDATE AFETR EVERY 5 READINGS
   {
     
             
     if(flag==0)                     //  CLEAR THE LCD TO AVOID ANY GARBAGE TEXT
     {
       lcd.clear();
       lcd.print("SENSOR MEASURING");
       flag=1;                          //   AFTER FLAG = 1 , THE LOOP WILL NOT EXECUTE AGAIN
     }
     
     rpm = 30*1000/(millis() - time)*REV;       //  CALCULATE  RPM USING REVOLUTIONS AND ELAPSED TIME
     
     if(rpm > maxRPM)
     maxRPM = rpm;                             //  GET THE MAX RPM THROUGHOUT THE RUN
   
     time = millis();                           
     
     REV = 0;
     
     int x= rpm;                                //  CALCULATE NUMBER OF DIGITS IN RPM
     while(x!=0)
     {
       x = x/10;
       RPMlen++;
     }       
         
     
     
     if(RPMlen!=prevRPM)                             // IF THE RPM FALLS TO A LOWER NUMBER WITH LESS DIGITS , THE LCD WILL GET CLEARED
     {
       lcd.clear();
       prevRPM = RPMlen;
       flag=0;
       lcd.print("SENSOR MEASURING");
     }
     
     lcd.setCursor(0, 1);
     lcd.print(rpm,DEC);                        //  PRINT RPM IN DECIMAL SYSTEM
     
     lcd.setCursor(6,1);
     lcd.print("RPM");
     delay(500);
     
     prevtime = currtime;                        // RESET IDLETIME
   
   }
   
   if(idletime > 5000 )                      //  IF THERE ARE NO READING FOR 5 SEC , THE SCREEN WILL SHOW MAX RPM
   {
     
     if(flag==1)                            // CLEAR THE LCD
     {
       lcd.clear();
       flag=0;
     }
     
     lcd.clear();
     lcd.print("MAXIMUM RPM");
     lcd.setCursor(0, 1);
     lcd.print(maxRPM,DEC);                     // DISPLAY MAX RPM
     lcd.print("   RPM");
     delay(2000);
     lcd.clear();
     lcd.print("IDLE STATE");
     lcd.setCursor(0, 1);
     lcd.print("READY TO MEASURE");
     delay(2000);
     prevtime = currtime;
   }
     
 }
 
 void RPMCount()                                // EVERYTIME WHEN THE SENSOR GOES FROM LOW TO HIGH , THIS FUNCTION WILL BE INVOKED
 {
   REV++;                                         // INCREASE REVOLUTIONS
   
   if (led == LOW)
   {
     
     led = HIGH;                                 //  TOGGLE STATUS LED
   }
   
   else
   {
     led = LOW;
   }
   digitalWrite(ledPin, led);
 }
//////////////////////////////////////////////////////////////  END OF THE PROGRAM  ///////////////////////////////////////////////////////////////////////       

PaulS

So, why do YOU think ShiftLCD does name a type? There is NOTHING in your code that warrants that silly notion.
The art of getting good answers lies in asking good questions.

JSinAZ

#5
Mar 07, 2015, 03:11 am Last Edit: Mar 07, 2015, 03:14 am by JSinAZ
LiquidCrystal lcd(8,10,9);   // is the way you should be writing this.

I think you are missing some arguments there. What type of LCD are you using serial, Parallel, I2c, SPI???

adam1997gipe

Wow, of course its obvious. I don't know how I missed it  :smiley-fat:

Thanks guys! I'll go back to Youtube and try to relearn how to do some of this

nickgammon

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).
Please post technical questions on the forum, not by personal message. Thanks!

More info: http://www.gammon.com.au/electronics

Go Up