Home Next>>

Introduction to ByPic

(and the web IDE)
This tutorial starts with the device up, running and connected as shown in fig.1. Follow the steps.
terminalok
Fig 1 The Terminal

Step 1: Click anywhere in the terminal area and press enter, this will produce an okay as in fig.2

datatypes
Fig 2 Data types

Step 2: Type in the terminal area:

The * is a times and the hello world MUST have double quotes at the start and end.

Variables

Fig 3 Variable types

Step 3: Enter dim a,f#,s$ in the terminal area then press enter

That has created three variables of three different types, integer, floating point and string.

variables
Fig 4 Variables

Step 4: Enter:

You have placed some values in those variables

anotherint
Fig 5 Adding another int

Step 5: Enter:

We can use variables in the same way as numbers or strings. Try doing the same but using a string variable, for example:

Programming

function myfunc()
dim j
    for j = 1 to 5
        print "hello Me"
    next
endf
Fig 6 First Program

Step 6: Type the above into the text editor (see fig 7) or copy and paste it. Make sure there is a blank line after the endf

edit1
Fig 7 First Program

Step 7: Use the |A icon to send this text over to the device, when complete you will see that the terminal has 'Done' in its contents (fig. 8)

termaftersend
Fig 8 After sending function

Step 8: type func() This will run the function just created

myfunc1
Fig 9 running myfunc()

This would be better if the text was in a vertical line, we can do this by placing a carriage return and line feed on the end of the text

editlinebreak
Fig 10 modify myfunc()

Step 9: Add \r\n to the en of the text as shown in fig. 10

Step 10: Press |A to send the text over to the device again

myfunc2
Fig 11 running modified myfunc()

Step 11: type myfunc() to run the function again

Notes

You can send the modified text or other text as as times as you like, it is stored in the devices RAM ready for running. A function can call other functions and a program is built of many functions. Each one can be tested individually. There are also library functions that have already been written to drive the I/O pins for example or perhaps an LCD display. Thse can be included or added to your own functions.

One possible way of thinking about this is that the functions are like the component parts of a machine, one all of the parts have been created the machine can be put together and also just like in engineering some of the parts can be put together as an assembly and tested before going onto the machine. Yhis is exactly the same for functions.