diff --git a/kulifuli-arduino.ino b/kulifuli-arduino.ino index e2ed9d5..8fd4563 100644 --- a/kulifuli-arduino.ino +++ b/kulifuli-arduino.ino @@ -64,6 +64,8 @@ void loop () { if ( Serial . available () ) { int input = Serial . read () ; + // In order to avoid serial writes by software other than kulifuli-host messing things up, + // we check for a specific sequence of 8 bytes before the byte that contains the new duty cycle if ( seqPos == 0 && input == 188 || seqPos == 1 && input == 92 || @@ -77,7 +79,7 @@ void loop () { // Advance in the sequence seqPos ++ ; } else if ( seqPos == 8 ) { - // `input` is the new duty cycle + // Sequence completed, `input` is the new duty cycle OCR1AL = input ; OCR1BL = input ; Serial . write (input) ;