Did save as now get this error

made copy from a working sketch

did save as

i open that version now get error

also it copy all the files auto matic in the directory
< CODE/ >
//#include "PluggableUSBHID.h"
//#include "USBKeyboard.h"
//USBKeyboard Keyboarda;

//Keyboarda.printf("a");
//#include "Arduino_GigaDisplay_GFX.h"
//GigaDisplay_GFX display; // create the object

// Create RGB object

//-----------------------------------
//#define BLACK 0x0000
//#define WHITE 0xffff
//#define RED 0xf805
//#define GREEN 0x07e4

//---------------------------- test code --------------------

#include "USBHostGiga.h"

//REDIRECT_STDOUT_TO(Serial)
Keyboard keyb;
HostSerial ser;
uint8_t rotation = 180;

void setup() {
// put your setup code here, to run once:
//Wire.begin();
//-------------- pin --------------------------
pinMode(13, OUTPUT);// a
pinMode(12, OUTPUT);// d
pinMode(11, OUTPUT);// s
pinMode(10, OUTPUT);// w
pinMode(9, OUTPUT);// f

pinMode(LED_BUILTIN, OUTPUT); // testing

//--------------------------------------------
// display.begin();

//display.fillScreen(BLACK);
//display.setCursor(10,10); //x,y
//display.setTextSize(2); //adjust text size
//display.setTextColor(WHITE,BLACK);
//display.print("Hello World!"); //print
//---------------------------------------
//display.drawCircle(100, 100, 50, WHITE);
// Keyboard.begin();

//while (!Serial); <<< kan je nog terug zetten als niet meer werkt zonder deze doet ook zonder pc
pinMode(PA_15, OUTPUT);
keyb.begin();
ser.begin();
}

void loop() {

//delay(1);
String userInput = "";
while (true) {
if (keyb.available() > 0) {
auto _key = keyb.read();
char inputChar = keyb.getAscii(_key);
//display.print(inputChar);
//display.setCursor(10,10); //x,y
//isplay.drawPixel(40, 40, WHITE);
//-------------------------------------
//display.setCursor(10,60); //x,y
//display.setTextSize(4); //adjust text size
//isplay.setTextColor(GREEN);
//display.print("probeer"); //print
//display.setTextColor(BLACK,BLACK);
//display.setCursor(400,10); //x,y
//display.print("#");
//display.setTextColor(GREEN);
//display.setCursor(400,10); //x,y
//display.fillRect(390, 10, 80, 40, BLACK);

  //display.print(inputChar); //print test

  //display.drawRect(390, 10, 80, 20, GREEN); // drawRect(x, y, width,height, color)
  
  
  if (inputChar == '1') {
    Serial.println("test regel 1");
    
    
    
  } 
  //----------------------------------------------------
  if (inputChar == '2') {
    Serial.println("test regel 2");
    
    
  }  
  //----------------------------------------------------
  if (inputChar == ' ') {
    //Serial.println("test regel leeg");
    //digitalWrite(LED_BUILTIN, LOW);
    //display.setTextColor(GREEN);
    //display.setCursor(400,10); //x,y
    //display.setTextSize(4); //adjust text size
    //display.print("-"); //print
    
    //display.fillRect(390, 10, 80, 40, BLACK);

    
    
    
  }  
  //----------------------------------------------------
  if (inputChar == 'h') {
    Serial.println("h");
    digitalWrite(12, HIGH);
    delay(10);
    digitalWrite(12, LOW);
    delay(10);
    
  }  
  //----------------------------------------------------
  //----------------------------------------------------
  if (inputChar == 'g') {
    Serial.println("g");
    digitalWrite(3, HIGH);
    delay(1000);
    digitalWrite(3, LOW);
    
    
  }  
  //---------------------------------------------------- keyboard zondag ------------------------------------------------------
      
  if (inputChar == 'a') {
    Serial.println("pin13 out   pin 3v3 A");
    digitalWrite(13, LOW);
    
    
    
  }  
  else {
  digitalWrite(13, HIGH);
}

//-----------------------------------------------
//---------------------------------------------------- keyboard zondag ------------------------------------------------------
      
  if (inputChar == 'd') {
    Serial.println("pin12 out   pin 3v3 D");
    digitalWrite(12, LOW);
    
    
    
  }  
  else {
  digitalWrite(12, HIGH);
}

//-----------------------------------------------
//---------------------------------------------------- keyboard zondag ------------------------------------------------------
      
  if (inputChar == 's') {
    Serial.println("pin11 out   pin 3v3 S");
    digitalWrite(11, LOW);
    
    
    
  }  
  else {
  digitalWrite(11, HIGH);
}

//-----------------------------------------------
//---------------------------------------------------- keyboard zondag ------------------------------------------------------
      
  if (inputChar == 'w') {
    Serial.println("pin10 out   pin 3v3 W");
    digitalWrite(10, LOW);
    
    
    
  }  
  else {
  digitalWrite(10, HIGH);
}

//-----------------------------------------------
//---------------------------------------------------- keyboard zondag ------------------------------------------------------
      
  if (inputChar == 'f') {
    Serial.println("pin9 out   pin 3v3 F");
    digitalWrite(9, LOW);
    
    
    
  }  
  else {
  digitalWrite(9, HIGH);
}

//-----------------------------------------------


//-----------------------------------------------
if (inputChar == '1') {
    Serial.println("test regel 3 test keuken 1");
    digitalWrite(6, HIGH);
    
    
  }  
  else {
  digitalWrite(6, LOW);
}
//---------------------------------------------------






}

}
//------------------------------------------------------- zaterdag -------------------------------------------------------
digitalWrite(LED_BUILTIN, HIGH);

//---------------------------------BLUE

}

//------------------------------------------
void subroutinename() {
// program
}
< CODE/ >

Please don't post pictures of code

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the < CODE/ > icon above the compose window) to make it easier to read and copy for examination

https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum

This is the easiest way to tidy up the code and add the code tags

Start by tidying up your code by using Tools/Auto Format in the IDE to make it easier to read. Then use Edit/Copy for Forum and paste what was copied in a new reply. Code tags will have been added to the code to make it easy to read in the forum thus making it easier to provide help.

How?

If you copied it in the original directory, I suspect that that is the cause of the problem. Based on the tab pages in the screenshot, you have two ino files and each probably contains loop() (and possibly other duplicated functions).

Use "save as" and use a different sketch name (directory).

This is not an IDE problem hence your topic was moved to a more suitable location on the forum.

try save as also that also not working

You will have to clean up.

Option 1; this assumes that keyboard_copy_20240310143843.ino is the copy that you made.

  1. Close the IDE.
  2. Use windows explorer and navigate to the sketch directory where that file lives (C:\Users\Gebruiker\Documents\Arduino\keyboard_copy_20240310143843).
  3. Delete that file.
  4. Rename KeyBoardGiga.ino to keyboard_copy_20240310143843.ino.
  5. Start the IDE and try to compile.

It might be better to rename the file to something completely different, e.g myCopy.ino. In that case you will also have to rename the directory keyboard_copy_20240310143843 to myCopy.ino. This should prevent cached files being involved and confusing the linker.

Option2

  1. In the IDE, search for loop(); how many ino files do you find?
  2. i suspect two or more. Decide which one you want to keep and empty the other one(s).
  3. Try to compile.

it working now had delete save as version then rename it then delete some ino out of the directory

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.