| 
                     
                    
Create a library with the background image 
Add font file to Library 
 
Create a style for page with the image as background 
Create a style for page text 
Create a style to format the Time and Date correctly 
 
Create Fileobj variable required to write to file 
Create Res variable that holds save status 
 
Create a Value variable 
Create a Variable to store Time/Date 
 
Define a page named "pageName" with style "pageStyle" 
Create a key to save value and timestamp 
Create the text value 
Create a minus key to adjust value 
Create a plus key to adjust value 
 
Create function for plus key that limits value to 100 
Create function for minus key that limits value to 0 
create a function that saves value and timestamp 
Load RTC value into TimeVar 
Append the text file Log1.txt on SD card and add the value and TimeStamp and CR 
 
After loading show the page named "pageName" 
                    
                    
                     
                 | 
                
                     
LIB(background,"SDHC/bground.png"); 
LIB(asc_16,"SDHC/asc_16b.fnt");
 
 STYLE(pageStyle, Page) { image = background; }
 STYLE(textstyle, Text) { font = asc_16b; col =\\000d55; maxRows=2; justify=c;}
 STYLE(TimeStyle,Data) {type=text; length=100; format="H:i:s jS F Y";}
 
 VAR(varFileObj, 0, FILEASC );
 VAR(varRes,"",TXT);
 
 VAR(Value,50,U8);
 VAR(TimeVar,"",TimeStyle);
  
 PAGE(pageName, pageStyle)
 {
  POSN(240,176);
  KEY(key1,fncLogStatus1,150,50,TOUCH);
  POSN(240,116);
  TEXT(ValueText,Value,textStyle);
  POSN(185,116);
  KEY(KeyM,MinusF,40,40,TOUCHR);
  POSN(295,116);
  KEY(KeyP,PlusF,40,40,TOUCHR);
 }
 
 FUNC(PlusF){IF(Value<100?[CALC(Value,Value,1,"+");TEXT(ValueText,Value);;]);}
 FUNC(MinusF){IF(Value>0?[CALC(Value,Value,1,"-");TEXT(ValueText,Value);;]);} 
 FUNC( fncLogStatus1 )
 {
 LOAD(TimeVar,RTC);
 FILE( "APPEND", varRes, varFileObj, "SDHC/log1.txt",,,Value," - ",TimeVar, "\\0D\\0A" );;
 }
 SHOW(pageName);
 
 |