SparkFun Forums 

Where electronics enthusiasts find answers.

For the discussion of Arduino related topics.
By anishkgt
#190494
I am new to the Arduino thingy. Once i checked out a few projects, really impressed with the product. Always thought when it comes to micro-controllers i thought the programming part was all machine language and was not something for an average person. I understand the whole programming part and curious learn to even more. those said so, please bear with me.

So i wanted to do a sketch to control the pulse of a Spot welder via a SSR that i had made from parts from a microwave over. here is what i plan to do

Add a tactile switch to start the below
first pulse that would last 10milliseconds
Second pulse that would last 15milliseconds
Stop



So below is what i think it should be, can't try the same out as am waiting for my arduino to be delivered.
Code: Select all

int Relay = 10;

void setup() {
  pinMode (Relay, OUTPUT);
 
}

void loop() {
  digitalWrite(Relay, HIGH);
  delay(8);
  digitalWrite(Relay, LOW);
  delay(450);
  digitalWrite(Relay, HIGH);
  delay(10);
  digitalWrite(Relay, LOW);
  delay(3000);
}
So latter i wish to add a potentiometer to adjust the delay-off time of the SSR. So here again am guessing the below would accomplish it.
Code: Select all


int Relay = 10;
int PreWeld = A0;
int Weld = A1;
int PreDelay = 0;
int WeldDelay = 0;

void setup() {
  pinMode (Relay, OUTPUT);
  digitalWrite(Relay,HIGH);
}

void loop() {
  PreDelay = analogRead(PreWeld);
  WeldDelay = analogRead(Weld);
  digitalWrite(Relay, HIGH);
  delay(PreWeld);
  digitalWrite(Relay, LOW);
  delay(450);
  digitalWrite(Relay, HIGH);
  delay(Weld);
  digitalWrite(Relay, LOW);
  delay(3000);
}
Could somebody please help me here. Latter am hoping to add a display to show the time value of PreWeld and Weld if its not hard to do.