// 01_Counters_Start_v2.nxc // The purpose of this code: // To introduce the use of a SENSOR_TOUCH // To demonstrate diffent ways of displaying numbers string Text1 = "4)COUNT1= "; int Count1; void printYX( string str, int y=8, int x=0) { TextOut( x, (8-y)*8, str); } task main() { SetSensor(IN_1,SENSOR_TOUCH); ClearScreen(); while( true) { if (SENSOR_1 == 1) { Count1 = Count1+1; } printf("1)Count1=%5d" ,Count1); TextOut(1, LCD_LINE3, FormatNum("2)Count1=%5d" , Count1)); TextOut( 2,LCD_LINE5,"3)Count1=" ); NumOut( 70,LCD_LINE5, Count1); printYX( StrCat(Text1,FormatNum("%5d" , Count1)) ,7,3); } }