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 basic math operations

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 minus key which decrements VarB by 1 if greater than 1 then runs mathF
Create plus key which increments VarB by 1 if less than 9 then runs mathF

Create text entity for VARA
Create text entity for VARB
Create Text entity for + Calc VARC
Create Text entity for - Calc VARC
Create Text entity for * Calc VARC
Create Text entity for / Calc VARC
Create Text entity for % Calc VARC

Create mathF
Displays VARA and VARB
Does Calc VARA + VARB = VARC display at text1
Does Calc VARA - VARB = VARC display at text2
Does Calc VARA * VARB = VARC display at text3
Does Calc VARA / VARB = VARC display at text4
Does Calc VARA % VARB = VARC display at text5

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,5, FLT1);VAR(VarB,8, 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);
KEY(varBminus,[IF(VarB>1?[CALC(VarB,VarB,1,"-");]); RUN(mathF);],60,60,TOUCHR,35,200);
KEY(varBplus,[IF(VarB<9?[CALC(VarB,VarB,1,"+");]); RUN(mathF);],60,60,TOUCHR,135,200);
TEXT(Text0A,"",textStyle, 85, 100);
TEXT(Text0B,"",textStyle, 85, 200);
TEXT(Text1,"",textStyle, 320, 90);
TEXT(Text2,"",textStyle, 320, 130);
TEXT(Text3,"",textStyle, 320, 170);
TEXT(Text4,"",textStyle, 320, 210);
TEXT(Text5,"",textStyle, 320, 250);
}
FUNC(mathF)
{
TEXT(Text0A,VarA);TEXT(Text0B,VarB);
CALC(VarC,VarB,VarA,"+");TEXT(Text1,VarC);
CALC(VarC,VarB,VarA,"-");TEXT(Text2,VarC);
CALC(VarC,VarB,VarA,"*");TEXT(Text3,VarC);
CALC(VarC,VarB,VarA,"/");TEXT(Text4,VarC);
CALC(VarC,VarB,VarA,"%");TEXT(Text5,VarC);;
}
RUN(mathF);
SHOW(pageName);