so, at last, i FINALLY found an AWESOME hands-free way to blink my costume eyes! 2 Arduino nano everys, 2 servos, 2 IR obstacle detection sensors, and 2 battery packs! the eyes blink when the IR sensor detects your blink, and you can control 2 eyes, having them wink, or blink! BUT, one VERY IMPORTANT QUESTION! when i compile/verify the code, it says, "servo library claims to run on AVR, MEGAAVR, etc, instead of AVR/MEGAAVR and may not be compatible with your board". but then, the message dissapears and it compiled succesfully. i NEED to know why it says that message when the Arduino nano every is backwards-compatable with the code and no need to switch wires around... really confusing....
CODE IS HERE:
#include <Servo.h>
Servo tap_servo;
int sensor_pin = 7;
int tap_servo_pin =6;
int val;
Please copy and paste the exact warning message. Paraphrasing the message can result in the loss of essential information, which makes it less likely we can help you. And besides, why do that extra work to paraphrase, when a copy/paste is so much quicker?
"WARNING: library servo claims to run on (avr, megaAVR, sam, samd, nrf52, stm32f4) architectures and may be incompatable with your current board which runs on (megaavr) architectures."
it will not copy and paste, so i had to enable verbose errors so i can type it out.
OK, just as I feared, some essential information had been lost during the paraphrase.
The version of the Servo library you are using had a problem in that the compatible architectures list said "megaAVR", but the real architecture name for the Nano Every is "megaavr". The architecture compatibility check is case-sensitive, so the case mismatch causes the library to be seen as incompatible with the Nano Every, even though it is. I fixed this bug 1.5 years ago:
So, even though this warning is spurious and could be ignored, I can tell you are using a significantly outdated version of the library. If you dont' have a specific reason for doing so, I recommend you to update to the latest version. You can do so by following these instructions:
Sketch > Include Library > Manage Libraries...
Wait for the index update to finish.
In the "Filter your search..." field, type "servo".
Press Enter.
From the list of libraries, click on "Servo by Michael Margolis, Arduino".
Click the "Update" button.
Wait for the update to finish.
Click the "Close" button.
bopitlover12:
it will not copy and paste
Because being able to copy and paste is essential, you should probably try to figure that out. There is a nice tutorial on it here:
ok, i got the libraries updated, however, how do i add this "fix" for the case sensitive MEGAavr? is it something i have to copy and paste or is it something i download?
when it compiles with no error, does that mean it compiled successfully and it will now work? i didn't have to download that MEGAavr case sensitive thing either and it compiled properly free of errors!
GREAT! NOW IT WILL WORK PROPERLY! THANK YOU! that's all i need to know to get this working! i will update you on my progress so you can see how things are going soon!
yeah, but you didn't say if the whole thing would work! but i know it will work properly since it didn't question about the servo using case sensitive MEGAavr anymore.
well, i would like to know if the whole project will work since it compiled successfully without errors because if it doesn't, i don't wanna waste money on these boards i won't use for anything else.
Compiling successfully without errors or warnings is absolutely no guarantee that your program and circuit will work as you intended. This is just the way it is.
If your goal is to have fun and learn things while making a DIY project, then buy the boards! If you require something that will be guaranteed to work right out of the box, then you'll need to buy a pre-made commercial solution, since you'll never get that guarantee from a DIY project.
in file included from C:\Users\Owner\Documents\Arduino\libraries\Servo\src\Servo.h:73:0,
from C:\Users\Owner\Downloads\arduino_nano_ir_sensor\arduino_nano_ir_sensor.ino:1: C:\Users\Owner\Documents\Arduino\libraries\Servo\src\megaavr/ServoTimers.h:38:24: warning: '_timer' defined but not used [-Wunused-variable]
C:\Users\Owner\Documents\Arduino\libraries\Servo\src\megaavr\Servo.cpp: in function 'void initISR (timer16_sequence_t)':
C:\Users\Owner\Documents\Arduino\libraries\Servo\src\megaavr\Servo.cpp:83:40: warning: unused parameter 'timer' [-Wunused-parameter]
static void initISR (timer16_sequence_t timer)
what is this? i don't even need this for the main code to work. so i don't think a timer is needed. i didn't get this error until i checked, "compile errors, [ALL]" in the prefrences
They are compiler warnings. This is the compiler informing you about things that aren't errors, but might indicate a possible problem, or might be completely inoccuous.
bopitlover12:
i don't even need this for the main code to work. so i don't think a timer is needed.
You could not make that conclusion without having a complete understanding of the source code of the Servo library. Have you looked at that code? If not, then don't assume you know what is needed and what is not needed.
Most Arduino users are happy to treat libraries as black boxes. If you understand how to use the API (which is documented here for the Servo library), you can make the assumption that the library author didn't make any mistakes and that the library will work as expected. Even the most expert developer makes mistakes, and the authors of the many 3rd party libraries are often far from experts, but the libraries usually do work, so it's a reasonable approach, especially when it comes to the well established official libraries like Servo.
Some Arduino users even go so far as to treat sketches as black boxes. They just download some random sketch from the Internet, upload it to their Arduino board, and hope for the best. I'm not so much of a fan of that, because part of the whole point of Arduino is to learn to write code, but even someone doing a copy/paste project is bound to learn a lot and perhaps will be led into modifying the sketch or creating additional projects from scratch.
bopitlover12:
i didn't get this error until i checked, "compile errors, [ALL]" in the prefrences
There you go with the paraphrasing again. The setting is called "Compiler warnings". It's very important to understand the difference between errors and warnings.
it shows how it will work. the 2 servos act as my eyelids moving 0 to 180 degrees making it blink/wink individually!
you should be able to use this same code and same wiring diagram with arduino nano every, making it back wards competible. i still don't know what's going on. do i need to use the timer functions in the servo library for this to work with Arduino nano every? if i need to i can add the feature in since it is stated, but not used.
this will be a cool costume once i get it working!