Why is my code saying "Error Compiling for Arduino Nano"

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
animefruit
 
Posts: 332
Joined: Tue Feb 25, 2020 1:04 pm

Why is my code saying "Error Compiling for Arduino Nano"

Post by animefruit »

Hello.

This is Neal.

I have one RFM69 Radio and Servos and Sensors wired to an Arduino Nano and another Arduino Nano wired to another RFM69 Radio and Servo and Sensors.

I am trying to simply send a message through my RFM69 Radios with using part of the RadioHead69_RawDemoTXRX_OLED in my code.

My code moves a servo once the pressure sensors get pushed too much.

I commented out all the parts that has to do with buttons because I simply want it to send a message to the radios after my servo moves.

I commented where the radios are supposed to send a message to each other with "Start of Radio Sending Message" and "End of Radio Sending Message".

Here is my code:

Code: Select all

  #include <Servo.h>
#include "Wire.h"
#include "Adafruit_LiquidCrystal.h"

#include <RH_RF69.h>
 
#define LED 13// FOR LED

#define RF69_FREQ 434.0 

#if defined (__AVR_ATmega328P__)  // Feather 328P w/wing
  #define RFM69_INT     3  // 
  #define RFM69_CS      4  //
  #define RFM69_RST     2  // "A"
#endif

// Singleton instance of the radio driver
RH_RF69 rf69(RFM69_CS, RFM69_INT);



Adafruit_LiquidCrystal lcd(0);
 
Servo myservo1;
Servo myservo2;
 
//cant do A4 and A5(they are for lcd)
// Analogs 0 to 5
const int knockSensor = A0;
const int knockSensor1= A1;
const int knockSensor2= A2;
const int knockSensor3= A3;
const int knockSensor4= A6;
const int knockSensor5= A7;
 
 
const int threshold = 0;
int health = 500;
 
// 6 total sensor readings (from 0 to 5)
 
int sensorReading = 0;
int sensorReading1 =0;
int sensorReading2 =0;
int sensorReading3 =0;
int sensorReading4 =0;
int sensorReading5 =0;
 
 
int pos =0;
 
 
 
int deaths=1;// gonna be number of deaths
 
 
 
void setup()
 
{
 // pinMode(LED_BUILTIN, OUTPUT); //LED ON ARDUINO
  pinMode(LED, OUTPUT);//FOR LED
 
  Serial.begin(115200);//was 9600
  Serial.println("Nerf Target v0.0.1, github.com/mcoms/nerf-target, 2014.");

  pinMode(LED, OUTPUT);     
  pinMode(RFM69_RST, OUTPUT);
  digitalWrite(RFM69_RST, LOW);

 if (!rf69.init()) {
    Serial.println("RFM69 radio init failed");
    while (1);
  }    // failed


rf69.setTxPower(14, true);
 
// sg90
 
  lcd.begin (20 , 4);
  lcd.clear();
 
 
  Serial.begin(9600);
  myservo1.attach(9);
  myservo1.write(0);//was 0
 
  myservo2.attach(10);
  myservo2.write(45);//was 179
 
 
 
 
}
 
void loop()
{
  do
  {
 
 
    myservo1.detach();
    myservo2.detach();
 
    sensorReading = analogRead(knockSensor);
   
 
    lcd.setCursor(0, 1);
    Serial.println(health);
    lcd.println(health);
 
    if (sensorReading > threshold) {
 
      Serial.println("Knock!");
      health = health - sensorReading;
 
     
     
      Serial.print(sensorReading);
      lcd.print(sensorReading);
 
 
      int sensorValue = analogRead(A0);
 
      Serial.println(sensorValue);
 
 
     
     
 
 
     
      delay(1);
 
    }
 
//duplicate
 
sensorReading1= analogRead(knockSensor1);
 
 if (sensorReading1 > threshold) {
 
      Serial.println("Knock!");
      health = health - sensorReading1;
 
     
     
      Serial.print(sensorReading1);
      lcd.print(sensorReading1);
 
 
      int sensorValue = analogRead(A1);
 
      Serial.println(sensorValue);
 
 
      delay(1);
 
    }
 
 
 
//duplicate
 
sensorReading2= analogRead(knockSensor2);
 
 if (sensorReading2 > threshold) {
 
      Serial.println("Knock!");
      health = health - sensorReading2;
 
     
     
      Serial.print(sensorReading2);
      lcd.print(sensorReading2);
 
 
      int sensorValue = analogRead(A2);
 
      Serial.println(sensorValue);
 
 
      delay(1);
 
    }
 
 
 
 
//duplicate
 
sensorReading3= analogRead(knockSensor3);
 
 if (sensorReading3 > threshold) {
 
      Serial.println("Knock!");
      health = health - sensorReading3;
 
     
     
      Serial.print(sensorReading3);
      lcd.print(sensorReading3);
 
 
      int sensorValue = analogRead(A3);
 
      Serial.println(sensorValue);
 
 
      delay(1);
 
    }
 
 
 
//duplicate
 
 
 
sensorReading4= analogRead(knockSensor4);
 
 if (sensorReading4 > threshold) {
 
      Serial.println("Knock!");
      health = health - sensorReading4;
 
     
     
      Serial.print(sensorReading4);
      lcd.print(sensorReading4);
 
 
      int sensorValue = analogRead(A6);
 
      Serial.println(sensorValue);
 
 
      delay(1);
 
    }
 
 
 
//duplicate
 
sensorReading5= analogRead(knockSensor5);
 
 if (sensorReading5 > threshold) {
 
      Serial.println("Knock!");
      health = health - sensorReading5;
 
     
     
      Serial.print(sensorReading5);
      lcd.print(sensorReading5);
 
 
      int sensorValue = analogRead(A7);
 
      Serial.println(sensorValue);
 
 
      delay(1);
 
    }
 
 
 
 
 
 
 
  } while (health > 1);
 
 
 
  digitalWrite(LED_BUILTIN, HIGH);
  delay(2000);//was 2000             // FOR LED IN ARDUINO
  digitalWrite(LED_BUILTIN, LOW);
  delay(1000);
 
 
  /*
digitalWrite(LED, HIGH);
delay(2000);                 //FOR LED
digitalWrite(LED, HIGH);
delay(1000);
 */
  myservo1.attach(9);
  myservo2.attach(10);
 
  delay(15);
 //Servo Starts Moving Here
 for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
    // in steps of 1 degree
    myservo1.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15 ms for the servo to reach the position
  }
  for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
    myservo1.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);    // waits 15 ms for the servo to reach the position
 
 //Servo Stops Moving Here
  }



 
 delay(1000);
 


 
 //lcd.setCursor(0, 2);
      //Serial.println(deaths); //showind number of deaths on the lcd
      //lcd.println(deaths);
 
 
//deaths= deaths + 1;// adding deaths
 
 //Start of Radio Sending Message
 
 {  if (rf69.waitAvailableTimeout(100)) {
    // Should be a message for us now   
    uint8_t buf[RH_RF69_MAX_MESSAGE_LEN];
    uint8_t len = sizeof(buf);
    
   if (! rf69.recv(buf , & len )) {
      Serial.println("Receive failed");
      return;
    }
    digitalWrite(LED, HIGH);
    rf69.printBuffer("Received: ", buf, len);
    buf[len] = 0;
    
    Serial.print("Got: "); Serial.println((char*) buf);
   
  }

 // if (!digitalRead(Servo_B) )
 // {
  Serial.println("Servo Moved!");
    
  char radiopacket[20] = "Servo #";
  
  //  if (!digitalRead(Servo_B)) radiopacket[8] = 'B';
  
    //radiopacket[9] = 0;

    Serial.print("Sending "); Serial.println(radiopacket);
    rf69.send((uint8_t *)radiopacket, strlen(radiopacket));
    rf69.waitPacketSent();
  }
 
 //End of Radio Sending Message

 
  health = 500;
}
 
    


But I keep on getting the error "Error compiling for Arduino Nano"

A picture of the error is attached to this post.

Even when I added one of the libraries from the RadioHead69_RawDemoTXRX_OLED sketch to my code I got the same error.

Can you tell me how to fix this error?

If so that would be great.
Attachments
Error Compiling to Nano.PNG
Error Compiling to Nano.PNG (36.39 KiB) Viewed 820 times

User avatar
dastels
 
Posts: 15655
Joined: Tue Oct 20, 2015 3:22 pm

Re: Why is my code saying "Error Compiling for Arduino Nano"

Post by dastels »

Have you turned on verbose output during compilation?

Dave

User avatar
animefruit
 
Posts: 332
Joined: Tue Feb 25, 2020 1:04 pm

Re: Why is my code saying "Error Compiling for Arduino Nano"

Post by animefruit »

Yes.

I have that on.

here is the full error message for showing verbose output during compilation:
Arduino: 1.8.19 (Windows 10), Board: "Arduino Nano, ATmega328P"





















C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\mitzg\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\mitzg\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\mitzg\BANNED\Documents\Arduino\libraries -fqbn=arduino:avr:nano:cpu=atmega328 -vid-pid=0403_6001 -ide-version=10819 -build-path C:\Users\mitzg\AppData\Local\Temp\arduino_build_298488 -warnings=none -build-cache C:\Users\mitzg\AppData\Local\Temp\arduino_cache_601599 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=C:\Users\mitzg\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17 -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Users\mitzg\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17 -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=C:\Users\mitzg\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Users\mitzg\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -verbose C:\Users\mitzg\BANNED\Documents\Arduino\Original_with_OLED_TXRX_without_Buttuns\Original_with_OLED_TXRX_without_Buttuns.ino

CreateFile C:\Users\mitzg\AppData\Local\Temp\arduino_build_298488: The system cannot find the file specified.



Error compiling for board Arduino Nano.
From these error messages can you figure out how to fix this error?

User avatar
dastels
 
Posts: 15655
Joined: Tue Oct 20, 2015 3:22 pm

Re: Why is my code saying "Error Compiling for Arduino Nano"

Post by dastels »

This seems to be he issue:

Code: Select all

CreateFile C:\Users\mitzg\AppData\Local\Temp\arduino_build_298488: The system cannot find the file specified.
Might be an Arduino installation problem.

Can you verify that path exists?

Dave

User avatar
animefruit
 
Posts: 332
Joined: Tue Feb 25, 2020 1:04 pm

Re: Why is my code saying "Error Compiling for Arduino Nano"

Post by animefruit »

What do you mean by path?

How do I find out if “path” exsists?

User avatar
dastels
 
Posts: 15655
Joined: Tue Oct 20, 2015 3:22 pm

Re: Why is my code saying "Error Compiling for Arduino Nano"

Post by dastels »

Code: Select all

C:\Users\mitzg\AppData\Local\Temp\arduino_build_298488
Does that series of nested directories exist? Arduino seems think it doesn't.

Start at C:, open Users, in that open mitzg, etc.

Dave

User avatar
animefruit
 
Posts: 332
Joined: Tue Feb 25, 2020 1:04 pm

Re: Why is my code saying "Error Compiling for Arduino Nano"

Post by animefruit »

I couldn't really find what "path" or "series of nested directories" but I did find "C:" , and "mitzg".

I have some images attached that demonstrates what I found.

I first clicked on "Tl10684400A(C:)" in the first picture.

Then I clicked on "mitzg" in the second picture.

Then I clicked on "Users" in the third picture.

After that I didn't know where to go to find "path" or "series of nested directories.

But I clicked on "AppsData in the fourth picture in post below.

Then I clicked on "Local" in the fifth picture in post below.

That is where I found the file "Arduino 15" if that is proof the series of nested exist.

Is that proof they exist?

I also show what is inside of "Arduino 15" in the sixth picture in the post below.

Does any of this prove if the file exists or not?

Or did I do it wrong?
Attachments
I went to Mitzg.PNG
I went to Mitzg.PNG (103.12 KiB) Viewed 790 times
I went to Mitzg.PNG
I went to Mitzg.PNG (103.12 KiB) Viewed 790 times
I_Went_to_C.PNG
I_Went_to_C.PNG (113.24 KiB) Viewed 790 times

User avatar
animefruit
 
Posts: 332
Joined: Tue Feb 25, 2020 1:04 pm

Re: Why is my code saying "Error Compiling for Arduino Nano"

Post by animefruit »

Here are some more pictures of what I found:

What is inside "Arduino15" is below this post.
Attachments
Inside Mitzg.PNG
Inside Mitzg.PNG (132.47 KiB) Viewed 788 times
Inside App Data.PNG
Inside App Data.PNG (101.01 KiB) Viewed 788 times
Inside Local.PNG
Inside Local.PNG (127.61 KiB) Viewed 788 times

User avatar
animefruit
 
Posts: 332
Joined: Tue Feb 25, 2020 1:04 pm

Re: Why is my code saying "Error Compiling for Arduino Nano"

Post by animefruit »

What is inside "Arduino15":
Attachments
Inside Arduino 15.PNG
Inside Arduino 15.PNG (111.4 KiB) Viewed 787 times

User avatar
dastels
 
Posts: 15655
Joined: Tue Oct 20, 2015 3:22 pm

Re: Why is my code saying "Error Compiling for Arduino Nano"

Post by dastels »

Open C:
In that open Users
In that open mitzg
In that open AppData
In that open Local
In that open Temp
In that open arduino_build_298488

These are nested directories: Users in nested inside C:, mitzg is nested inside Users, and so on. Together this series of directories form a path through the filesystem. Directories are also called folders in GUI based file managers.

If at any point the directory you are looking for isn't there, you've found the problem.

See https://desktop.arcgis.com/en/arcmap/10 ... nd-url.htm for more information.

Dave

User avatar
animefruit
 
Posts: 332
Joined: Tue Feb 25, 2020 1:04 pm

Re: Why is my code saying "Error Compiling for Arduino Nano"

Post by animefruit »

I found "arduino build 577794" but not "arduino build 298488".

Is that ok?

Or does that mean there is a problem?

I have picture of it attached.
Attachments
arduino build 577794.PNG
arduino build 577794.PNG (144.66 KiB) Viewed 777 times

User avatar
dastels
 
Posts: 15655
Joined: Tue Oct 20, 2015 3:22 pm

Re: Why is my code saying "Error Compiling for Arduino Nano"

Post by dastels »

Not necessarily, those directories get created as needed, but we can see that the place they get created is there.

Things might have gotten out of sync (the build directory cleaned up but Arduino not realizing it).

Have you tried building again? Does the error keep coming up? Does the name of the arduino_build directory it complains about change?

Dave

User avatar
animefruit
 
Posts: 332
Joined: Tue Feb 25, 2020 1:04 pm

Re: Why is my code saying "Error Compiling for Arduino Nano"

Post by animefruit »

The same error does keep happening every time I compile my code.

The error messages doesn't seem to change.

Here is the error messages this time:
Arduino: 1.8.19 (Windows 10), Board: "Arduino Nano, ATmega328P"





















C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\mitzg\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\mitzg\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\mitzg\BANNED\Documents\Arduino\libraries -fqbn=arduino:avr:nano:cpu=atmega328 -vid-pid=0403_6001 -ide-version=10819 -build-path C:\Users\mitzg\AppData\Local\Temp\arduino_build_298488 -warnings=none -build-cache C:\Users\mitzg\AppData\Local\Temp\arduino_cache_601599 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=C:\Users\mitzg\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17 -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Users\mitzg\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17 -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=C:\Users\mitzg\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Users\mitzg\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -verbose C:\Users\mitzg\BANNED\Documents\Arduino\Original_with_OLED_TXRX_without_Buttuns\Original_with_OLED_TXRX_without_Buttuns.ino

CreateFile C:\Users\mitzg\AppData\Local\Temp\arduino_build_298488: The system cannot find the file specified.



Error compiling for board Arduino Nano.

It doesn't look like it changes.

Do you see any changes?

What do you mean by " tried building again?".

Building what?

Should I Build whatever your talking about?

User avatar
dastels
 
Posts: 15655
Joined: Tue Oct 20, 2015 3:22 pm

Re: Why is my code saying "Error Compiling for Arduino Nano"

Post by dastels »

I meant try building your sketch again. I.e. compile & link. In Arduino you click the checkmark button (it says "Verify" but it really compiles and links ... aka builds).

What happens if you create that directory? I.e. arduino_build_298488 in C:\Users\mitzg\AppData\Local\Temp\.

Dave

User avatar
animefruit
 
Posts: 332
Joined: Tue Feb 25, 2020 1:04 pm

Re: Why is my code saying "Error Compiling for Arduino Nano"

Post by animefruit »

I already compiled my sketch a few times which you referred to as “building”.

But how do I create that directory?

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”