Here is I’m trying to do:
- (void) fullDMXReceived:(NSString*)finalData {
if (finalData changed since the last time fullDMXReceived ran) {
//DO SOMETHING
}
}
Every 50miliseconds, a new value comes in. Sometimes it’s the same as the last – in this case, I don’t want the //dosomething to happen. ONLY, if the NSString finalData changes.
I know this is probably a simple answer, I’ve been messing around for a bit with it but to no avail.
Thanks!
Save the last string in a variable, check the new value against the old one, and skip the operation if the two are equal.
When the value is different, run the operation, and update the prior value to match the new one: