Go Down

Topic: How can i read pulse ,or 4-20 mA output from Arduino?  (Read 4479 times) previous topic - next topic

dlloyd

It looks like in the manual, the outputs can be configured and they also can be turned on or off.

Adam212

i already configured  to give me pulse ,and 4-20 mA output , and i can see the result in the device screen.

dlloyd

Example of connections:



EDIT: You could use a stronger pull-up if needed, i.e. 470 Ω and still be well within the output's max current limit of 500mA.

dlloyd

You could try something like this to test the digital input:

Code: [Select]
// constants
int pin = 2;  // digital input pin

// variables
unsigned long pulseCount = 0;
boolean inputStatus = LOW;
boolean inputStatusPrevious = LOW;

void setup() {
  pinMode(pin, INPUT);
  Serial.begin(115200);        //115200 for faster response
  Serial.println("Started");
  Serial.println("Pulse Count:");
  Serial.println(pulseCount);
}

void loop()
{
  inputStatus = digitalRead(pin);

  if (inputStatus == HIGH && inputStatusPrevious == LOW) {  //rising edge
    pulseCount++;
    Serial.println(pulseCount);
  }
  inputStatusPrevious = inputStatus;
}

Adam212

Thanks alot for your kind replay , i will check it and come back to you.
once again , Thank you.

Adam212

thanks a lot dlloyd , it's working now , i appreciate your help.
once again thank you dlloyd.

Go Up