Re:class PortListener implements InPortListener | Thales IoT Developer Community
October 30, 2014 - 3:23am, 2683 views
Hello,
I have the TC65 terminal controlling two buttons through GPIO ports.One is connected into GPIO4 and the other into GPIO6
I am using the PortListener method in order to detect any change.
The application is simple
If the button --GPIO4-- is pushed the count with one second delay should be initiated and present the result
which must be multiples of a reference value.
The main problem I have is I can 't stop the process by pressing the button controlled by the port GPIO6.
The hardware if working OK.The main application is controlled by a timer that stops it after 30 seconds.
Any suggestion?
I am using GPIO6 to stop the process without luck.
Thanks in advance/
class PortListener implements InPortListener
{
int value=4;
int cont=0;
int temp;
public void portValueChanged(int portValue)
{
while (portValue==1){
try {
Thread.sleep(1000);
cont++;
if(cont%value==0){
valor=cont;
System.out.println("Result:" + temp);
}
}catch(Exception e) {
e.printStackTrace();
}
if ((portValue==2) ||(portValue==3))
break;
}
}
}