Good Day,
I created a new project with the following details:
Arduino 328
Arduino board with ATmega328P
Controller
Family: AVR
Device: ATmega328P
Compiler: Arduino AVR
As Source code I added 3 *ino files from my project, which i created with the Arduino IDE.
But compiling failes. I get errors like "was not declared in the scope".
So functions, which I wrote in the second and third *ino file are not availabe in the main *ino.
How can I solve this problem?
PS:With only one *ino file it works.
Thank you
Arduino Simulation Multipe Source files *ino
Re: Arduino Simulation Multipe Source files *ino
I think you should declare explicitly the prototype of the functions in main.ino. For example given the func1 and func2 in funcs.ino:
You need to do this in your main.ino in order to compile without errors:
Please send your customer number in to support@labcenter.com so that we will provide you with further support.
Code: Select all
int func1(void) {
static int a;
return ++a;
}
int func2(void) {
static int b;
return ++b;
}
Code: Select all
/* Main.ino file generated by New Project wizard
*
* Created: mer nov 8 2023
* Processor: Arduino Uno
* Compiler: Arduino AVR
*/
// ***************************************************************
// ******** Declare the functions prototype in funcs.ino
// ***************************************************************
int func1(void);
int func2(void);
int a, b;
void setup () {
}
void loop() {
a = func1();
b = func2();
}
Kind regards,
Ettore Arena - Labcenter Electronics.
Ettore Arena - Labcenter Electronics.
Re: Arduino Simulation Multipe Source files *ino
Thanks for the support, but this solution seams not very practical.
Writing the declarations is ok:
but I also have to implement all variables which are used in the func1 and func2 manually:
I also not found out, how to implement a SoftwareSerial port in func1 and func2. I tried it with
but doesnt work.
What other options are possible?
I use the Arduino AVR Compiler.
Would the Arduino IDE Version Compiler solve this problem?
I couldnt test it, Download Link inside Proteus doesnt work.
If I install the Arduino IDE manually, Proteus doesnt find the compiler.
On Youtube, I found a lot of videos, importing the arduino library and using the compiled hex file.
But with this solution Im not able to see AVR/Variables window.
Writing the declarations is ok:
Code: Select all
void led_blinking_off(void);
void serial_receive_string(void);
Code: Select all
extern int LED1;
extern int LED2;
extern int LED3;
extern int LED4;
Code: Select all
extern SoftwareSerial charger;
What other options are possible?
I use the Arduino AVR Compiler.
Would the Arduino IDE Version Compiler solve this problem?
I couldnt test it, Download Link inside Proteus doesnt work.
If I install the Arduino IDE manually, Proteus doesnt find the compiler.
On Youtube, I found a lot of videos, importing the arduino library and using the compiled hex file.
But with this solution Im not able to see AVR/Variables window.
Re: Arduino Simulation Multipe Source files *ino
Hello,
In order to have multiple .ino files, you need to create project selecting "Arduino IDE 2" in the Compiler field. I've tested it and everything works just fine, including source level code debugging.
Regards,
Andy
In order to have multiple .ino files, you need to create project selecting "Arduino IDE 2" in the Compiler field. I've tested it and everything works just fine, including source level code debugging.
Regards,
Andy
Re: Arduino Simulation Multipe Source files *ino
Thanks, now it works fine.
For others, who have the same problem:
Install at least Proteus Version 8.17 (Beta) to use the Arduino IDE 2, important notes:
New Project (New Project Wizard)
Create Firmware Project (Compiler Arduino IDE 2).
Unhook the " Create Quick Start Files" and "Create Peripherals".
Right Click on the "ARDUINO_*" Folder in the left upper corner. Projects Settings.
If you want to use the original Arduino .ino files unhook "Embed Files".
A right click again on the "ARDUINO_*" Folder. Add Files.
At your .ino files.
Now you can use the Arduino IDE 2 and Proteus 8.17 at the same.
Make changes in the Arduino IDE then compile, save or autosave. After that you can directly simulate the code in Proteus.
For others, who have the same problem:
Install at least Proteus Version 8.17 (Beta) to use the Arduino IDE 2, important notes:
New Project (New Project Wizard)
Create Firmware Project (Compiler Arduino IDE 2).
Unhook the " Create Quick Start Files" and "Create Peripherals".
Right Click on the "ARDUINO_*" Folder in the left upper corner. Projects Settings.
If you want to use the original Arduino .ino files unhook "Embed Files".
A right click again on the "ARDUINO_*" Folder. Add Files.
At your .ino files.
Now you can use the Arduino IDE 2 and Proteus 8.17 at the same.
Make changes in the Arduino IDE then compile, save or autosave. After that you can directly simulate the code in Proteus.