Logic of port/pin function

Here is where you can request new features or special features.

Re: Logic of port/pin function

Postby dezsoe » Mon Oct 08, 2018 2:45 pm

This little function works with the most common cards (UC100, UC300_5LPT, UC300ETH_5LPT, UC300ETH_UB1 and UC400ETH):

Code: Select all
int GetLEDNumber(int port, int pin)
{
  int LED = -1;
  switch (port)
  {
    case 1:
      LED = pin;
      break;
    case 2:
      LED = 68 + pin;
      break;
    case 3:
      LED = 85 + pin;
      break;
    case 4:
      LED = 102 + pin;
      break;
    case 5:
      LED = 119 + pin;
      break;
  }
  return LED;
}

And you can check the input state:

Code: Select all
if (exec.GetLED(GetLEDNumber(port, pin)))
...
dezsoe
 
Posts: 2049
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Return to Feature Request

Who is online

Users browsing this forum: No registered users and 1 guest

cron