Greetings and salutations...
I have obtained a large quantity of Atmega32, 40 pin chips, and I have been trying to compile a sketch, for as one type of servo controller. I am using the Arduino IDE, ver. 1.8.19, as the ISP, and the "MightyCore", as the core. I will post the sketch below. I keep getting errors, that it "error compiling for board 'Atmega32'.Here is my sketch -
#include <ServoTimers.h>
#include <Servo.h>
Servo myservo; // create servo object to control a servo
int pos;
/* This program is for the single turnout control point, on the signal system network
this firmware, is used for both left and right single turnouts, used for pasing trks, and controlled turnouts, from dispatch.
*/
const int code = 16; // N.O. Pushcode
const int sw_Normal_Direction = 8; // left position of SPDT toggle switch
const int sw_Reverse_Direction = 9; // right positiion of SPDT Toggle Switch
const int block_det = 14;
// myservo.attach(15); // attaches the servo on pin 15 to the servo object
void setup() {
// int myservo;
// twelve servo objects can be created on most boards
myservo.attach(15); // attaches the servo on pin 15 to the servo object
pinMode(code, INPUT); // sets code to be in the input mode
pinMode(sw_Normal_Direction, INPUT); // switch normal setup
pinMode(sw_Reverse_Direction, INPUT); // switch Reverse setup
pinMode(block_det, INPUT);
}
void loop() {
int pos;
int code_State;
int sw_Normal_Direction_State;
int sw_Reverse_Direction_State;
int block_det_State;
block_det_State = digitalRead(block_det);
code_State = digitalRead(code);
sw_Normal_Direction_State = digitalRead(sw_Normal_Direction);
sw_Reverse_Direction_State = digitalRead(sw_Reverse_Direction);
digitalRead(code_State);
digitalRead(sw_Normal_Direction_State);
digitalRead(sw_Reverse_Direction_State);
digitalRead(block_det_State);
if(sw_Normal_Direction_State == LOW && code_State == LOW){
if(pos <= 116){
for (pos = 58; pos <= 116; pos += 1) { // goes from 65 degrees to 114 degrees
// in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(40); // waits 30ms for the servo to reach the position
digitalRead(sw_Normal_Direction_State);
}
}
}
digitalRead(code_State);
digitalRead(sw_Normal_Direction_State);
digitalRead(sw_Reverse_Direction_State);
if(sw_Reverse_Direction_State == LOW && code_State == LOW){
if(pos >= 58){
for (pos = 112; pos >= 58; pos -= 1) { // goes from 114 degrees to 67 degrees
// in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(45); // waits 30ms for the servo to reach the position
digitalRead(sw_Reverse_Direction_State);
}
}
}
}
And here are the errors I get.
Arduino: 1.8.19 (Windows 7), Board: "ATmega32, No bootloader, EEPROM retained, Standard pinout, BOD disabled, LTO enabled, Internal 1 MHz"
C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\Kims\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\Kims\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Kims\Documents\Arduino\libraries -fqbn=MightyCore:avr:32:bootloader=no_bootloader,eeprom=keep,pinout=standard,BOD=disabled,LTO=Os_flto,clock=1MHz_internal -vid-pid=2341_0043 -ide-version=10819 -build-path C:\Users\Kims\AppData\Local\Temp\arduino_build_44258 -warnings=all -build-cache C:\Users\Kims\AppData\Local\Temp\arduino_cache_108806 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Users\Kims\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Users\Kims\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.avr-gcc.path=C:\Users\Kims\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Users\Kims\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.avrdude.path=C:\Users\Kims\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino18 -prefs=runtime.tools.avrdude-6.3.0-arduino18.path=C:\Users\Kims\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino18 -verbose I:\1A CTC SIGNAL SCHEMATICS\CONTROL POINT FIRMWARE\RIGHT HAND TURNOUT CONTROL POINT\RIGHT_HAND_TURNOUT_CONTROL_POINT_Firmware\RIGHT_HAND_TURNOUT_CONTROL_POINT_Firmware.ino
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\Kims\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\Kims\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Kims\Documents\Arduino\libraries -fqbn=MightyCore:avr:32:bootloader=no_bootloader,eeprom=keep,pinout=standard,BOD=disabled,LTO=Os_flto,clock=1MHz_internal -vid-pid=2341_0043 -ide-version=10819 -build-path C:\Users\Kims\AppData\Local\Temp\arduino_build_44258 -warnings=all -build-cache C:\Users\Kims\AppData\Local\Temp\arduino_cache_108806 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Users\Kims\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Users\Kims\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.avr-gcc.path=C:\Users\Kims\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Users\Kims\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.avrdude.path=C:\Users\Kims\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino18 -prefs=runtime.tools.avrdude-6.3.0-arduino18.path=C:\Users\Kims\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino18 -verbose I:\1A CTC SIGNAL SCHEMATICS\CONTROL POINT FIRMWARE\RIGHT HAND TURNOUT CONTROL POINT\RIGHT_HAND_TURNOUT_CONTROL_POINT_Firmware\RIGHT_HAND_TURNOUT_CONTROL_POINT_Firmware.ino
Using board '32' from platform in folder: C:\Users\Kims\AppData\Local\Arduino15\packages\MightyCore\hardware\avr\2.1.3
Using core 'MCUdude_corefiles' from platform in folder: C:\Users\Kims\AppData\Local\Arduino15\packages\MightyCore\hardware\avr\2.1.3
Warning: Board arduino:avr:mega32-16 doesn't define a 'build.board' preference. Auto-set to: AVR_MEGA32-16
Warning: Board arduino:avr:atmega16o doesn't define a 'build.board' preference. Auto-set to: AVR_ATMEGA16O
Warning: Board arduino:avr:mega32-8 doesn't define a 'build.board' preference. Auto-set to: AVR_MEGA32-8
Warning: Board arduino:avr:atmega644o doesn't define a 'build.board' preference. Auto-set to: AVR_ATMEGA644O
Warning: Board arduino:avr:mega32-1 doesn't define a 'build.board' preference. Auto-set to: AVR_MEGA32-1
Warning: Board arduino:avr:atmega32o doesn't define a 'build.board' preference. Auto-set to: AVR_ATMEGA32O
Warning: Board arduino:avr:atmega1284o doesn't define a 'build.board' preference. Auto-set to: AVR_ATMEGA1284O
Detecting libraries used...
"C:\\Users\\Kims\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++17 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -w -x c++ -E -CC -mmcu=atmega32 -DF_CPU=1000000L -DARDUINO=10819 -DARDUINO_AVR_ATmega32 -DARDUINO_ARCH_AVR -Wextra -flto -g "-IC:\\Users\\Kims\\AppData\\Local\\Arduino15\\packages\\MightyCore\\hardware\\avr\\2.1.3\\cores\\MCUdude_corefiles" "-IC:\\Users\\Kims\\AppData\\Local\\Arduino15\\packages\\MightyCore\\hardware\\avr\\2.1.3\\variants\\standard" "C:\\Users\\Kims\\AppData\\Local\\Temp\\arduino_build_44258\\sketch\\RIGHT_HAND_TURNOUT_CONTROL_POINT_Firmware.ino.cpp" -o nul
Alternatives for ServoTimers.h: [Servo@1.1.1]
ResolveLibrary(ServoTimers.h)
-> candidates: [Servo@1.1.1]
"C:\\Users\\Kims\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++17 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -w -x c++ -E -CC -mmcu=atmega32 -DF_CPU=1000000L -DARDUINO=10819 -DARDUINO_AVR_ATmega32 -DARDUINO_ARCH_AVR -Wextra -flto -g "-IC:\\Users\\Kims\\AppData\\Local\\Arduino15\\packages\\MightyCore\\hardware\\avr\\2.1.3\\cores\\MCUdude_corefiles" "-IC:\\Users\\Kims\\AppData\\Local\\Arduino15\\packages\\MightyCore\\hardware\\avr\\2.1.3\\variants\\standard" "-IC:\\Users\\Kims\\AppData\\Local\\Arduino15\\packages\\MightyCore\\hardware\\avr\\2.1.3\\libraries\\Servo\\src" "C:\\Users\\Kims\\AppData\\Local\\Temp\\arduino_build_44258\\sketch\\RIGHT_HAND_TURNOUT_CONTROL_POINT_Firmware.ino.cpp" -o nul
"C:\\Users\\Kims\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++17 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -w -x c++ -E -CC -mmcu=atmega32 -DF_CPU=1000000L -DARDUINO=10819 -DARDUINO_AVR_ATmega32 -DARDUINO_ARCH_AVR -Wextra -flto -g "-IC:\\Users\\Kims\\AppData\\Local\\Arduino15\\packages\\MightyCore\\hardware\\avr\\2.1.3\\cores\\MCUdude_corefiles" "-IC:\\Users\\Kims\\AppData\\Local\\Arduino15\\packages\\MightyCore\\hardware\\avr\\2.1.3\\variants\\standard" "-IC:\\Users\\Kims\\AppData\\Local\\Arduino15\\packages\\MightyCore\\hardware\\avr\\2.1.3\\libraries\\Servo\\src" "C:\\Users\\Kims\\AppData\\Local\\Arduino15\\packages\\MightyCore\\hardware\\avr\\2.1.3\\libraries\\Servo\\src\\Servo.cpp" -o nul
Generating function prototypes...
"C:\\Users\\Kims\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++17 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -w -x c++ -E -CC -mmcu=atmega32 -DF_CPU=1000000L -DARDUINO=10819 -DARDUINO_AVR_ATmega32 -DARDUINO_ARCH_AVR -Wextra -flto -g "-IC:\\Users\\Kims\\AppData\\Local\\Arduino15\\packages\\MightyCore\\hardware\\avr\\2.1.3\\cores\\MCUdude_corefiles" "-IC:\\Users\\Kims\\AppData\\Local\\Arduino15\\packages\\MightyCore\\hardware\\avr\\2.1.3\\variants\\standard" "-IC:\\Users\\Kims\\AppData\\Local\\Arduino15\\packages\\MightyCore\\hardware\\avr\\2.1.3\\libraries\\Servo\\src" "C:\\Users\\Kims\\AppData\\Local\\Temp\\arduino_build_44258\\sketch\\RIGHT_HAND_TURNOUT_CONTROL_POINT_Firmware.ino.cpp" -o "C:\\Users\\Kims\\AppData\\Local\\Temp\\arduino_build_44258\\preproc\\ctags_target_for_gcc_minus_e.cpp"
"C:\\Program Files (x86)\\Arduino\\tools-builder\\ctags\\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\\Users\\Kims\\AppData\\Local\\Temp\\arduino_build_44258\\preproc\\ctags_target_for_gcc_minus_e.cpp"
Compiling sketch...
"C:\\Users\\Kims\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -Wall -Wextra -std=gnu++17 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega32 -DF_CPU=1000000L -DARDUINO=10819 -DARDUINO_AVR_ATmega32 -DARDUINO_ARCH_AVR -Wextra -flto -g "-IC:\\Users\\Kims\\AppData\\Local\\Arduino15\\packages\\MightyCore\\hardware\\avr\\2.1.3\\cores\\MCUdude_corefiles" "-IC:\\Users\\Kims\\AppData\\Local\\Arduino15\\packages\\MightyCore\\hardware\\avr\\2.1.3\\variants\\standard" "-IC:\\Users\\Kims\\AppData\\Local\\Arduino15\\packages\\MightyCore\\hardware\\avr\\2.1.3\\libraries\\Servo\\src" "C:\\Users\\Kims\\AppData\\Local\\Temp\\arduino_build_44258\\sketch\\RIGHT_HAND_TURNOUT_CONTROL_POINT_Firmware.ino.cpp" -o "C:\\Users\\Kims\\AppData\\Local\\Temp\\arduino_build_44258\\sketch\\RIGHT_HAND_TURNOUT_CONTROL_POINT_Firmware.ino.cpp.o"
In file included from C:\Users\Kims\AppData\Local\Arduino15\packages\MightyCore\hardware\avr\2.1.3\libraries\Servo\src/Servo.h:52:0,
from I:\1A CTC SIGNAL SCHEMATICS\CONTROL POINT FIRMWARE\RIGHT HAND TURNOUT CONTROL POINT\RIGHT_HAND_TURNOUT_CONTROL_POINT_Firmware\RIGHT_HAND_TURNOUT_CONTROL_POINT_Firmware.ino:4:
C:\Users\Kims\AppData\Local\Arduino15\packages\MightyCore\hardware\avr\2.1.3\libraries\Servo\src/ServoTimers.h:65:16: error: redeclaration of '_timer1'
typedef enum { _timer1, _Nbr_16timers } timer16_Sequence_t ;
^~~~~~~
In file included from I:\1A CTC SIGNAL SCHEMATICS\CONTROL POINT FIRMWARE\RIGHT HAND TURNOUT CONTROL POINT\RIGHT_HAND_TURNOUT_CONTROL_POINT_Firmware\RIGHT_HAND_TURNOUT_CONTROL_POINT_Firmware.ino:2:0:
C:\Users\Kims\AppData\Local\Arduino15\packages\MightyCore\hardware\avr\2.1.3\libraries\Servo\src/ServoTimers.h:65:16: note: previous declaration 'timer16_Sequence_t _timer1'
typedef enum { _timer1, _Nbr_16timers } timer16_Sequence_t ;
^~~~~~~
In file included from C:\Users\Kims\AppData\Local\Arduino15\packages\MightyCore\hardware\avr\2.1.3\libraries\Servo\src/Servo.h:52:0,
from I:\1A CTC SIGNAL SCHEMATICS\CONTROL POINT FIRMWARE\RIGHT HAND TURNOUT CONTROL POINT\RIGHT_HAND_TURNOUT_CONTROL_POINT_Firmware\RIGHT_HAND_TURNOUT_CONTROL_POINT_Firmware.ino:4:
C:\Users\Kims\AppData\Local\Arduino15\packages\MightyCore\hardware\avr\2.1.3\libraries\Servo\src/ServoTimers.h:65:25: error: redeclaration of '_Nbr_16timers'
typedef enum { _timer1, _Nbr_16timers } timer16_Sequence_t ;
^~~~~~~~~~~~~
In file included from I:\1A CTC SIGNAL SCHEMATICS\CONTROL POINT FIRMWARE\RIGHT HAND TURNOUT CONTROL POINT\RIGHT_HAND_TURNOUT_CONTROL_POINT_Firmware\RIGHT_HAND_TURNOUT_CONTROL_POINT_Firmware.ino:2:0:
C:\Users\Kims\AppData\Local\Arduino15\packages\MightyCore\hardware\avr\2.1.3\libraries\Servo\src/ServoTimers.h:65:25: note: previous declaration 'timer16_Sequence_t _Nbr_16timers'
typedef enum { _timer1, _Nbr_16timers } timer16_Sequence_t ;
^~~~~~~~~~~~~
In file included from C:\Users\Kims\AppData\Local\Arduino15\packages\MightyCore\hardware\avr\2.1.3\libraries\Servo\src/Servo.h:52:0,
from I:\1A CTC SIGNAL SCHEMATICS\CONTROL POINT FIRMWARE\RIGHT HAND TURNOUT CONTROL POINT\RIGHT_HAND_TURNOUT_CONTROL_POINT_Firmware\RIGHT_HAND_TURNOUT_CONTROL_POINT_Firmware.ino:4:
C:\Users\Kims\AppData\Local\Arduino15\packages\MightyCore\hardware\avr\2.1.3\libraries\Servo\src/ServoTimers.h:65:41: error: conflicting declaration 'typedef enum timer16_Sequence_t timer16_Sequence_t'
typedef enum { _timer1, _Nbr_16timers } timer16_Sequence_t ;
^~~~~~~~~~~~~~~~~~
In file included from I:\1A CTC SIGNAL SCHEMATICS\CONTROL POINT FIRMWARE\RIGHT HAND TURNOUT CONTROL POINT\RIGHT_HAND_TURNOUT_CONTROL_POINT_Firmware\RIGHT_HAND_TURNOUT_CONTROL_POINT_Firmware.ino:2:0:
C:\Users\Kims\AppData\Local\Arduino15\packages\MightyCore\hardware\avr\2.1.3\libraries\Servo\src/ServoTimers.h:65:41: note: previous declaration as 'typedef enum timer16_Sequence_t timer16_Sequence_t'
typedef enum { _timer1, _Nbr_16timers } timer16_Sequence_t ;
^~~~~~~~~~~~~~~~~~
Using library Servo at version 1.1.1 in folder: C:\Users\Kims\AppData\Local\Arduino15\packages\MightyCore\hardware\avr\2.1.3\libraries\Servo
exit status 1
Error compiling for board ATmega32.
The 'boards.txt file has also been appended, for the Atmega32 chip, and several other 40 pin controllers, with similar pinnouts.
I am not sure of the cause. I have tried using the 'servo' library, from the IDE installation, and it gives me the same error. I have tried several ways to load these included library's, and they timing of loading them in, such as 'servo'.h' first, then the '#include <ServoTimers.h>' next, and it gives me 3 different servo headers, what was used and not used, but, If I load the servo.h first, it loads in both servo.h files. I get a completely different error, with it.
I have read the error display, and see some thing regarding it set for a different 'Board', and nothing about the Atmega32.
Either way, I am trying to learn how this is happening. I am inexperienced with the error codes cryptic methods, but, I understand it wasn't ever that verbose. The IDE has the boxes checked for verbose errors, compilation, and upload. I cannot understand what I am missing, and if I can understand why this is working this way, it will help me learn, how to avoid this type of error, and help others in the future.
Please, I do NOT mind learning, and I do learn faster, if I am shown what I could have done to make it work properly. I really need all of you geniouses out there, to help me set this thing on the proper path, so I don't frustrate others, with learning new things about programming the correct way. Of course, I would rather not depend solely upon you good volunteers, for everything, cuz it sure helps to learn this stuff through and through. There has got to be a great big bunch of you out there, that prolly know this off the top of your head, without even squeezing out a hard problem. It kind of makes me feel in awe of the abilities I can learn, and I am gladly willing to do so!
Many Thanks in advance for any help I may get.
Respectfully submitted...
Kim