func displaySingleFrame(display *hd44780.HD44780, bytes []byte, duration time.Duration) { //Display Line 0 rightBound := 16 if len(bytes) < 16 { rightBound = len(bytes) } // log.Println("Line 0: " + string(bytes[0:rightBound])) for _, char := range bytes[0:rightBound] { err := display.WriteChar(char) utils.LogErrorandExit("Cannot write char to LCD:", err) } //Display Line 1 if len(bytes) > 16 { display.SetCursor(0, 1) rightBound = 32 if len(bytes) < 32 { rightBound = len(bytes) } // log.Println("Line 1: " + string(bytes[16:rightBound])) for _, char := range bytes[16:rightBound] { err := display.WriteChar(char) utils.LogErrorandExit("Cannot write char to LCD:", err) } } //Wait for the given duration time.Sleep(duration) }