Uno R3 using a nano 33 IoT as a momentary switch with bluetooth

Hello I am running a 12v linear actuator off an Arduino UNO R3, and a motor driver board (HiLetgo BTS7960) with two momentary push buttons to drive forward, and back. I would like to replace one of the buttons (the back button) with a nano 33 IoT for bluetooth control. I know that this is probably a wasteful use of this powerful little board, but I already own it and don't want to spend more money. I already have all these parts and would prefer to not buy anything new. here is the diagram

`/* Firgelli Automations
 * Limited or no support: we do not have the resources for Arduino code support
 * 
 * Program enables momentary direction control of actuator using push button
 */

int RPWM = 10; //connect Arduino pin 10 to IBT-2 pin RPWM
int LPWM = 11; //connect Arduino pin 11 to IBT-2 pin LPWM
int downPin = 12; 
int upPin = 13;
int Speed = 255; //choose any speed in the range [0, 255]

void setup() {
  pinMode(RPWM, OUTPUT);
  pinMode(LPWM, OUTPUT);
  pinMode(downPin, INPUT_PULLUP);
  pinMode(upPin, INPUT_PULLUP);
}

void loop() { 
  if(digitalRead(upPin)==LOW){ //check if extension button is pressed
    analogWrite(RPWM, 0);
    analogWrite(LPWM, Speed);
  } 

  else if(digitalRead(downPin)==LOW){ //check if retraction button is pressed
    analogWrite(RPWM, Speed);
    analogWrite(LPWM, 0);
  } 

  else{ //if no button is pushed, remain stationary
    analogWrite(RPWM, 0); 
    analogWrite(LPWM, 0);
  }
}`

this code is from firgelli automation
it works right now, but it would be cool to have the reverse be controlled with bluetooth from my phone. Any help on this or an article that might point me in the right direction would be cool. Thanks!

For obvious reasons, I don't follow unknown links. Read the pinned post re 'How to get the most from the forum', and then post what we need to see, code and wiring diagram.
Based on your words, yes, it's a huge waste, but simple: first, grab a BT sample for the 33 IoT that mimics a button and change the output to have a pin on the 33 IoT replace the button.

1 Like

When helpers find it here the interest is higher. Please extract the information requested in the link posted by @sonofcy.

thank you I am fairly new to this I will update the post to not include a link

If the existing button uses the fairly common construct of INPUT_PULLUP and the button is wired from pin to G, then just move the G wire to the new module G and the pin wire to a pin on the IoT 33. Then in code detect whatever from your phone to then change the pin to

so pin 12 from the uno to a pin on the nano?

or is there just a better way to do this with just the nano?

I would like to replace one of the buttons (the back button) with a nano 33 IoT for bluetooth control

is there just a better way to do this with just the nano?

Yes, I would think that you could run the linear actuator with the nano as the mcu instead of the uno. The specifications for the Hiletgo BTS7960 indicate that it can use 3.3v input.

Yes, get rid of the UNO and just use the NANO. In the IDE, change the board in the drop-down from UNO to NANO and see if it compiles. I copied the sketch, and it is fine.