New Page 1

How To Do - Example Projects

Click on the title to open the example project
Click on the How to projects above to see the basic sample code to help you create your projects quickly and efficiently.
Each "How To" has a overall description as well as a basic line by line detail of code.
You can download the project or copy the menu file to clipboard
 
Basic Entities     Basic animation     Basic functions  
Add Image   Create button   Basic math operations
Draw colour boxes   Show page - multiple pages   Math functions
Draw colour lines   Flashing text message   Create random number
Draw colour vectors   Animation with pointers   Plus and Minus
Draw colour circles   Scroll text message   Show and format Time and Date
Draw colour ellipses   Move images (TouchX, TouchY)   Save Timestamp to text file  
Draw arcs (ellipses with angle)   Move images with buttons   Password Entry Lock  
Add multiple rows text     Move images (press button)     Menu Selection  
Use pointers   Create slider      
Text Hello World   Show and hide entities   Graphs
Create Dynamic Entities     Dial needle   Create X-Bar Graph
      PNG Transparency     Create Y-Bar Graph  
Interfaces and Hardware             Trace graph from array  
Create IO Counter           Draw sinusoid graph   
External Key             Draw graph - DNA style
Use A to D converters           Draw line graph  
Send and receive data - RS232          
Keyboard Control            
           
 

How to save time and Date to textfile

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);