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 draw sinusoid graph

Add background image to library
Create page style
Create a trace graph style
Create variables for X Y XS
Create variables for Shift, col and test

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

Create a graph
Create a key that runs graphF

Create graphF

resets graph
Calculates a random number between 0-200 into Shift
Creates a loop that runs 205 times

Calculates XS by adding random number to X
Calculates Y value by SIN the XS
Multiplies Y by 70
Adds 95 to Y
Calculate x modules 40 into test
if test = 0 then generate col using random command and change graph col
draw graph at X Y
Take 20 from Y
Add 10 to X
Draw graph at X Y
Take 8 from X

Reset X value

Run graphF function
After loading show the page named "pageName"

LIB(background,"SDHC/bground.png");

STYLE(pageStyle,Page){image=bground;}
STYLE(gstyle,DRAW){type=trace;col=blue;width=4;curRel=CC;}
VAR(Y,0,FLT4);VAR(X,0,U16);VAR(XS,0,U16);
VAR(Shift,0,U16);VAR(Col,0,U32);VAR(Test,0,U8);

PAGE(pageName,pageStyle)
{
DRAW(graph1,420,190,gstyle,240,130);
KEY(key1,graphF,480,272,TOUCHR,240,136);
}
FUNC(graphF)
{
RESET(graph1);
CALC(Shift,200,"RND");
LOOP(Loop1,205)
{
CALC(XS,Shift,X,"+");
CALC(Y,XS, "SIN" );
CALC(Y,Y,70,"*");
CALC(Y,Y,95,"+");
CALC(Test,X,40,"%");
IF(Test=0?[CALC(Col,16777215,"RND");LOAD(gstyle.col,Col);]);
DRAW(graph1,X,Y);
CALC(Y,Y,20,"-");
CALC(X,X,10,"+");
DRAW(graph1,X,Y);
CALC(X,X,8,"-");
}
LOAD(X,0);;
}
RUN(graphF);
SHOW(pageName);