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 do - math functions

Add background image to library
Add font file to library
Create page style
Create text style
Create Float variables VARA-C

Define a page named "pageName" with style "pageStyle"

Create minus key which decrements VarA by 1 if greater than 1 then runs mathF
Create plus key which increments VarA by 1 if less than 9 then runs mathF

Create text entity for VARA
Create Text entity for EXP Calc VARC
Create Text entity for LOG Calc VARC
Create Text entity for LOG10 Calc VARC
Create Text entity for POW Calc VARC
Create Text entity for SQR Calc VARC
Create Text entity for CBRT Calc VARC

Create mathF
Displays VARA and VARB
Does Calc VARA EXP = VARC display at text1
Does Calc VARA LOG = VARC display at text2
Does Calc VARA LOG10 = VARC display at text3
Does Calc VARA POW = VARC display at text4
Does Calc VARA SQRT = VARC display at text5
Does Calc VARA CBRT = VARC display at text6

Run mathF func
After loading show the page named "pageName"

LIB(background,"SDHC/bground.png");
LIB(asc_16b,"SDHC/asc_16b.fnt");
STYLE(pageStyle, Page) { image = background; }
STYLE(textStyle, Text) { font=asc_16b; col=mediumblue;}
VAR(VarA,3, FLT1);VAR(VarC,0, FLT1);

PAGE(pageName, pageStyle)
{
KEY(varAminus,[IF(VarA>1?[CALC(VarA,VarA,1,"-");]); RUN(mathF);],60,60,TOUCHR,35,100);
KEY(varAplus,[IF(VarA<9?[CALC(VarA,VarA,1,"+");]); RUN(mathF);],60,60,TOUCHR,135,100);
TEXT(Text0,"",textStyle, 85, 100);
TEXT(Text1,"",textStyle, 320, 60);
TEXT(Text2,"",textStyle, 320, 100);
TEXT(Text3,"",textStyle, 320, 140);
TEXT(Text4,"",textStyle, 320, 180);
TEXT(Text5,"",textStyle, 320, 220);
TEXT(Text6,"",textStyle, 320, 260);
}
FUNC(mathF)
{
TEXT(Text0,VarA);
CALC(VarC,VarA,"EXP");TEXT(Text1,VarC);
CALC(VarC,VarA,"LOG");TEXT(Text2,VarC);
CALC(VarC,VarA,"LOG10");TEXT(Text3,VarC);
CALC(VarC,VarA,"POW");TEXT(Text4,VarC);
CALC(VarC,VarA,"SQRT");TEXT(Text5,VarC);
CALC(VarC,VarA,"CBRT");TEXT(Text6,VarC);;
}
RUN(mathF);
SHOW(pageName);