Long live arduino
Please help me i am new to arduino, please set code for proximity sensor, if i want to control 5 pneumatic cylinder, vacuum gripper, stepper motor nema 23 with tb6600 driver,12v dc gear motor,electromagnet and inductive proximity sensor with arduino.
1 pneumatic cylinder = c1
2 pneumatic cylinder = c2
3 pneumatic cylinder =c3
4 pneumatic cylinder =c4
5 pneumatic cylinder =c5
6 vacuum =v
7stepper motor with tb6600 driver with 3 pin =
stepPin,dirPin,enPin
8 gear motor =GM
9 electromagnet =EM
10 proximity sensor =PS
Please help me when proximity sensor is “on” only
Gear motor (GM) should work in reverse and all other functions should stop and againafter short delay all functions should be activated and so on.
NOTE :PROXIMITY SENSOR WILL ACTIVE AFTER 15MIN UPTO 15 MIN GEAR MOTOR IS GOING IN FORWARD DIRECTION
Int c1 = 2;
Int v = 3;
Int GM = 4;
Int stepPin = 5;
Int dirPin = 6;
Int enPin = 7;
Int c2 = 8;
Int c3 = 9;
Int c4 = 10;
Int c5= 11;
Int EM = 12;
void setup () {
pinMode(c1,OUTPUT);
pinMode(v,OUTPUT);
pinMode(GM,OUTPUT);
pinMode(stepPin,OUTPUT);
pinMode(dirPin,OUTPUT);
pinMode(enPin,OUTPUT);
pinMode(c2,OUTPUT);
pinMode(c3,OUTPUT);
pinMode(c4,OUTPUT);
pinMode(c5,OUTPUT);
pinMode(EM,OUTPUT);
digitalWrite(enPin,LOW);
}
void loop () {
digitalWrite(c1,HIGH);
delay(100);
digitalWrite(v,HIGH);
delay(100);
digitalWrite(c1,LOW);
delay(100);
digitalWrite(GM,HIGH);
delay(100);
digitalWrite(GM,LOW);
delay(50);
digitalWrite(dirPin,HIGH);
for(int x =0;x<800;x++){
digitalWrite(stepPin,HIGH);
delayMicrosecond(500);
digitalWrite(stepPin,LOW);
delayMicrosecond(500);
}
digitalWrite(c1,HIGH);
delay(100);
digitalWrite(v,LOW);
delay(100);
digitalWrite(c1,LOW);
delay(100);
digitalWrite(c2,HIGH);
delay(100);
digitalWrite(c2,LOW);//no delay
digitalWrite(c3,HIGH);
delay(100);
digitalWrite(c3,LOW);
delayMicrosecond(500);
digitalWrite(dirPin,LOW);
for(int x=0;x<800;x++){
digitalWrite(stepPin,HIGH);
delayMicrosecond(500);
digitalWrite(stepPin,LOW);
delayMicrosecond(500);
}
digitalWrite(c4,HIGH);
delay(100);
digitalWrite(c5,HIGH);
delay(100);
digitalWrite(EM,HIGH);
delay(100);
digitalWrite(c5,LOW);
delay(100);
digitalWrite(c4,LOW);
delay(100);
digitalWrite(EM,LOW);
}
incomplete_without_proximity_sensor.ino (1.48 KB)