HELP! Arduino nano every servo

bopitlover12:
can you tell us why it wouldn't work when this program originally worked on the Arduino nano while i want it to work on arduino nano every.

Because the two boards have different processors?

Have you actually tested the program to see if it works or not? All you have are compiler WARNINGS. These do not stop it compiling or loading or working.

Test the program and if it really doesn't work report back with what it does and doesn't do. Oh and you'll need to post the program too because we can't help with something we can't see.

Steve

no that wouldn't make a difference. maybe it's cause it has the undefined timer variable in the servo.h library that is supposedd to make it work. and because i still see the megaavr lowercase thing in it too. i don't think i need the timer thing for the main code to work.

oh, i posted the link to the video and code and wiring diagram earlier in a post. here it is again.

"this is where i got the code from:

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!"

I'll ask again. Have you actually loaded the code and tried it to see if it works? If not, what makes you think that it's not going to work?

Steve

i shouldn't have this much trouble with having the main code to work that is supposed to be backwards compatible with both boards (nano and nano every) and should work on the every without having to change anything. i don't have the boards yet because i want you to help me get the main code working properly, then i buy the boards and battery packs, upload code to boards, wire everything up and it will already work with no problems.

here's another crazy question: if you have the proper parts at home with you, can you test it out for me?

So basically you have no idea if it will work or not because you don't have anything to run it on. So you're just wasting our time. No-one can ever guarantee that your program will work because even if it works on someone else's system there are so many other things you could get wrong with the wiring, the parts and the power.

Steve

well, i have the servos and the IRs and the regular nanos (i bought them before i changed my mind) i started with, but no nano everys and battery packs.

Nice! So you have everything you need to start having some fun with Arduino. Get to it!

i have to get the nano everys cause that's the actual board i'll use. i know it works on the nano as the video says. i just need it to work on nano every, which shouldn't be this big of a problem!

You're right it shouldn't be a problem so get the Nano Every and try it.

Steve

ya i will! will it be a waste of money if it doesn't work?

No, it won't be a waste, because you will have learned something

because the code and wiring diagrams are backwards compatible with both boards, i think it will work just fine!

Basically, we can't just magically know if something will work or not with code that we don't have and hardware that isn't sitting in front of us. These are prototype, hobbyist boards and components. It's not like this is commercial product support.

There's no reason you need two arduinos and two power packs, BTW:

#include <Servo.h>

Servo left_tap_servo;
Servo right_tap_servo;

const int left_sensor_pin = 7;
const int left_tap_servo_pin =6;
const int right_sensor_pin = 8;
const int right_tap_servo_pin =9;

void setup(){
  pinMode(left_sensor_pin,INPUT);
  pinMode(right_sensor_pin,INPUT);
  left_tap_servo.attach(left_tap_servo_pin);
  right_tap_servo.attach(right_tap_servo_pin);
  
}

void loop(){
  byte val;

  val = digitalRead(left_sensor_pin);

  if (val==LOW)
  {
    left_tap_servo.write(0);
  }
  else
  {
    left_ tap_servo.write(180);
  }

  val = digitalRead(right_sensor_pin);

  if (val==LOW)
  {
    right_tap_servo.write(0);
  }
  else
  {
    right_ tap_servo.write(180);
  }
}

well, that way in the code where you don't need 2 nanos is kinda confusing. i like it better when there's 2 of everything. if i had 1 nano, and 1 battery pack, that would mean i would have to use more batteries to be able to power both servos. well, i'll try the main code i originally found and tell you if it works. i don't see why it can't work.