Last active
August 29, 2015 14:11
-
-
Save madhephaestus/4143ada38e0450ad3775 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CounterInputTestAsync implements ICounterInputListener{ | |
//The Counter channel is a property of the class | |
private CounterInputChannel dip; | |
public CounterInputTestAsync(){ | |
//Instantiate a new Counter channel | |
//The second parameter tells the Counter channel that is it an asynchronous channel | |
dip = new CounterInputChannel(dyio.getChannel(23),true); | |
//Add this instance of the Tester class to the Counter channel | |
dip.addCounterInputListener(this); | |
//Run forever printing out Counter events | |
System.out.println("Running..."); | |
while (ana.addAnalogInputListener(this);){ | |
Thread.sleep(100); | |
} | |
// remove listener on exit | |
dip.removeCounterInputListener(this); | |
} | |
@Override | |
public void onCounterValueChange(CounterInputChannel source, int value) { | |
//Check the source of the event | |
if (source == dip) | |
System.out.println("Counter event:"+value); | |
} | |
} | |
new CounterInputTestAsync(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment