func main() { //test color/additional functions here ansiterm.ResetTerm(ansiterm.NORMAL) ansiterm.ClearPage() ansiterm.MoveToXY(10, 10) sleepOne() ansiterm.HideCursor() sleepOne() ansiterm.SetFGColor(5) fmt.Printf("TEST MOVE HIDDEN CURSOR / OUT IN PURPLE") sleepOne() ansiterm.MoveToXY(10, 12) ansiterm.SetColorBright() fmt.Printf("BRIGHT COLORS") sleepOne() ansiterm.MoveToXY(10, 14) ansiterm.SetColorNormal() fmt.Printf("NORMAL COLORS AGAIN") sleepOne() ansiterm.ShowCursor() sleepOne() ansiterm.ResetTerm(ansiterm.NORMAL) }
func main() { ansiterm.ResetTerm(0) ansiterm.ClearPage() initFields() startSensors() runfor = 1 done := time.After(time.Duration(runfor) * time.Minute) fmt.Printf("This demo will stop after %d minutes\n", runfor) L1: for { select { case t := <-temp.Ch: temp.Show(fmt.Sprintf("%d", t)) case t := <-clock.Ch: clock.Show(fmt.Sprintf("%d", t)) case t := <-seekerrs.Ch: seekerrs.Show(fmt.Sprintf("%d", t)) // note: label is required else it 'breaks' the select, not the for case _ = <-done: break L1 } } if false { os.Exit(0) } ansiterm.ClearPage() }
func test_1() { const pauseSec = 2 fmt.Printf("Test_001\n") ansiterm.ResetTerm(ansiterm.NORMAL) defer ansiterm.ClearPage() ansiterm.ClearPage() Headline("this headline should be on row 1") StatusUpdate("one") pause(pauseSec) ansiterm.MoveToRC(3, 1) Headline("erase page and print Test on third line") StatusUpdate("two") fmt.Printf("Test\r") pause(pauseSec) Headline("erase first 3 chars on third line") StatusUpdate("three") ansiterm.Erase(3) pause(pauseSec) Headline("print Best on third line") StatusUpdate("four") fmt.Printf("Best\r") pause(pauseSec) Headline("erase entire third line") StatusUpdate("five") ansiterm.ClearLine() pause(pauseSec) Headline("print Rest on third line") StatusUpdate("six") fmt.Printf("Rest\r") pause(pauseSec) Headline("move to 10,10 and print a msg") StatusUpdate("seven") ansiterm.MoveToRC(10, 10) fmt.Printf("x at 10,10") pause(pauseSec) }