Welcome!

This community is for professionals and enthusiasts of our products and services. Share and discuss the best content and new marketing ideas, build your professional profile and become a better marketer together.

0

Changing from Ardbox to Ardbox Relay

By
Grant
on 6/23/20, 3:52 AM 132 views

I have the blow working code for an ardbox but would now like to convert it to run on Ardbox relay, I have  tried changing Q0_1 to R1 etc with no success. I also get an A0_6 was not declared in this scope error.


Any helps would be appreciated.



************************************START**********************************

unsigned int eStop; 

unsigned int startCutting;

unsigned int bottomSwitch;

unsigned int mercurySwitch;

unsigned int viceEnagage;

unsigned int viceDisenagage;

unsigned int sawUp;

unsigned int goodClamp;

unsigned int transHomeSw=0;

unsigned int state=0;

unsigned int computerInput=0;


void setup()

{

  Serial.begin(9600);

  //ANALOGUE/DIGITAL INPUTS

  pinMode(I0_9, INPUT); //eStop

  pinMode(I0_8, INPUT); //green start switch

  pinMode(I0_7, INPUT); //bottom switch (saw has completed cut)

  pinMode(I0_6, INPUT); //mercury switch (Saw has reached clearance height)

  pinMode(I0_5, INPUT); //computerInput

  pinMode(I0_4, INPUT); //vice disengage (UNLATCH)

  pinMode(I0_3, INPUT); //vice engaged (Vice is correctly pressurised)(LATCH)

  pinMode(I0_2, INPUT); //goodclamp (HIGH == no pressure)

  pinMode(I0_1, INPUT); //AUTO/MANUAL

  //ANALOGUE OUTPUTS

  pinMode(A0_6, OUTPUT); //toComputer

  pinMode(A0_5, OUTPUT); //?? unused ??

  pinMode(A0_4, OUTPUT); //?? unused ??

  pinMode(A0_3, OUTPUT); //?? unused ??

  pinMode(A0_2, OUTPUT); //?? unused ??

  pinMode(A0_1, OUTPUT); //?? unused ??

  pinMode(A0_0, OUTPUT); //?? unused ??

  //DIGITAL OUTPUTS

  pinMode(Q0_9, OUTPUT); //NOT WORKING

  pinMode(Q0_8, OUTPUT); //NOT WORKING

  pinMode(Q0_7, OUTPUT); //Pneumatic to hydrolic control (LATCHING)

  pinMode(Q0_6, OUTPUT); //NOT WORKING

  pinMode(Q0_5, OUTPUT); //blade on/off

  pinMode(Q0_4, OUTPUT); //coolant on/off

  pinMode(Q0_3, OUTPUT); //hydrolic pressure (Hydralick pump)

  pinMode(Q0_2, OUTPUT); //NOT WORKING

  pinMode(Q0_1, OUTPUT); //NOT WORKING

  pinMode(Q0_0, OUTPUT); //hydralic solinoid (is combined with Q0_3 hydralic pressure to rais saw)

}


void loop()

{

  if (state==0)

  {

    mercurySwitch = digitalRead(I0_6);

    goodClamp = digitalRead(I0_2); //pressure

    viceEnagage = digitalRead(I0_3); //pressure lever

    Serial.println(viceEnagage);

    viceDisenagage = digitalRead(I0_4);

    if (viceEnagage)

    {

      digitalWrite(Q0_7, LOW);

      delay(100);

      digitalWrite(Q0_3, HIGH);

      delay(100);

      digitalWrite(Q0_2, HIGH);


    }

    else

    {

      digitalWrite(Q0_3, LOW);

      digitalWrite(Q0_2, LOW);

    }

    if (viceDisenagage)

    {

      digitalWrite(Q0_7, HIGH);

      delay(100);

    }

    if (mercurySwitch)

    {

      // saw up

      digitalWrite(Q0_3, HIGH);

      digitalWrite(Q0_0, HIGH);

      delay(100);

      digitalWrite(Q0_3, LOW);

    }

    else

    {

      // saw down

      digitalWrite(Q0_0, LOW);

    }

    startCutting = digitalRead(I0_5);

    eStop = digitalRead(I0_9);

    if (startCutting && eStop)

    {

      digitalWrite(Q0_7, LOW);

      delay(200);

      while (goodClamp)

      {

        digitalWrite(Q0_3, HIGH);

        goodClamp = digitalRead(I0_2);

      }

      digitalWrite(Q0_3, LOW);

      digitalWrite(Q0_0, LOW);

      state++;

    }

  }


  else if (state==1)

  {

    // Blade ON

    digitalWrite(Q0_5, HIGH);

    // Coolant

    digitalWrite(Q0_4, HIGH);

    bottomSwitch = digitalRead(I0_7);

    delay(250);

    while (!bottomSwitch)

    {

      viceEnagage = digitalRead(I0_3);

      bottomSwitch = digitalRead(I0_7);

      eStop = digitalRead(I0_9);

      if (!eStop) //! means switch is pushed

      {

        break;

      }

      else if (viceEnagage)

      {

        digitalWrite(A0_3, HIGH);

        delay(100);

        digitalWrite(A0_3, LOW);

      }

    }

    // Blade off

    digitalWrite(Q0_5, LOW);

    // Coolant off

    digitalWrite(Q0_4, LOW);

    digitalWrite(Q0_7, HIGH);

    state=0;

  }


  else if (state==2)

  {

 

  }

}

*****************************************END*****************************************


0
Industrial Shields Forum user

Andrei Postolache

--Andrei Postolache--

2000000000
| 0 0 0
--Andrei Postolache--
Andrei Postolache
On 7/17/20, 4:12 AM

Hello,

First of all to work with relay output you need to declare it like this RX_X. example: R0_1

Second, in your PLC doesn't exist the analog output A0_6, that model just have two analog outputs A0_0, A0_1.


Thank you.


Keep Informed

About This Community

This community is for professionals and enthusiasts of our products and services. Share and discuss the best content and new marketing ideas, build your professional profile and become a better marketer together. Read Guidelines

Question tools

11 follower(s)

Stats

Asked: 6/23/20, 3:52 AM
Seen: 132 times
Last updated: 8/17/20, 7:00 AM