Arduino for Simple-Scada

What needs to change in the code to have a digital input to use in Scada ?

Code :

bool func_D2(const char *itemID, const opcOperation opcOP, const bool value){
static bool ledValue_D2 = false;
if (opcOP == opc_opwrite) {
ledValue_D2 = value;
if (ledValue_D2)
digitalWrite(pin_D2, LOW);
else
digitalWrite(pin_D2, HIGH);
}
else
return ledValue_D2;
}

Image from Original Post so we don't have to download it. See this Image Guide

...R

emoxristov:
What needs to change in the code to have a digital input to use in Scada ?

What exactly does the bold part mean?

Are you referring to a specific Scada program or function? If so post a link so we can read its specification.

In an Arduino a digital input is usually detected with digitalRead()

...R

How to add delay to pin output ?
bool func_D2(const char *itemID, const opcOperation opcOP, const bool value){
static bool ledValue_D2 = false;
if (opcOP == opc_opwrite) {
ledValue_D2 = value;
if (ledValue_D2)
digitalWrite(pin_D2, LOW);
delay(2000);
digitalWrite(pin_D2, LOW);
else
digitalWrite(pin_D2, HIGH);
delay(2000);
digitalWrite(pin_D2, HIGH);
}
else
return ledValue_D2;
}

Why this code does not work how to make the code by holding on HIGH-LOW

Why have you started 2 Threads on the same subject? As the other Thread seems to be newer an getting responses please click Report to Moderator and ask to have this Thread locked so people don't waste time answering both.

...R