Analog to wifi control for linear actuator

Hello y'all
I am fairly new to Arduino, but love it. I need to use a linear actuator for some home automation stuff. I got it working with two buttons based on wiring and code from Push Button Control with Arduino | Firgelli Automations . one button out; other button in. pretty straight forward. I did this just to see how that worked. this is all done on an Arduino uno. Now I want to recreate this with an Arduino wifi and make the buttons digital buttons on the IoT Remote app for iPhone. Now I will post the diagram I used for wiring and the code that is from GitHub that goes along with it.
https://cdn.shopify.com/s/files/1/0615/2193/files/push_button_arduino_motor_driver_bb_10f1ccde-8f3f-4db5-8743-5cc3f5bacc73_large.png?v=1591745921

that was the image also found in the original link and here is the code copied form the link as well as being found on GitHub.

/* 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 is not my design or code so if there is anything I could have done better please let me know. in conclusion I want to make this a low key IoT solution. thanks in advance.

Ahab

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.