SLOW DIGITAL READ RESPONSE

userHead h0bbit 2017-07-27 00:23:05 3269 Views3 Replies
Hi,

I have posted a similar topic about getting a slow digital read response a few weeks back but got no response.

I am using the Lattepanda Firmata developing a C# application for my project. I am using below code just to test/debug. I am providing a step pulse to the stepper for the forward motion while checking for an index position.

//--------------------------------------------------------------
do{
arduino.digitalWrite(12, Arduino.HIGH);
Thread.Sleep(5);
arduino.digitalWrite(12, Arduino.LOW);
Thread.Sleep(5);

index +=arduino.digitalRead(2); //also tried removing the '+' and leave '=' only
}while(index==0); //expecting index to toggle to '1' when the sensor is hit/blocked
//-----------------------------------------------------

I also tried using a FOR loop providing more steps and sometimes the index will toggle with several steps delayed or not respond at all.

Need help.

thanks,
-H0bbit