Programming - First steps
P.
77 of 349
The graph is shifted at each
function call
When calling the function, the icon of the web element with
ID
(number between 0 and 255) will also
be set to the symbol with the number
Icon
. Possible graphs are shown on page 159. In addition,
predefined constants facilitate the selection listed in Table 2 (page 159). The argument
Text
indicates an arbitrary variable the value of which is transformed into a string is displayed at the
variable text line of web element. Each icon has at least the states ACTIVE (==1), INACTIVE (==2),
DARKRED (==0) and BRIGHTRED (==9).
One of these states can be passed in the argument
State
. An overview of the possible states is
shown in Table 3 (page 159). The text to be displayed can be printed in the styles GREY (==0),
GREEN (==1), BLINKRED(==2) and BLINKBLUE (==3).
For the display of values, we use the state DISPLAY (==3) of the icons. This condition does not exist
for all icons, see page 291.
Finally, we still miss the ability to fill the XY diagrams with values. There is the function
webchart
(
ID, Var{u08}, X1{c14}, X2{c14}
)
The function accesses the XY diagram
chart
. If
ID
occurs multiple times, then all elements with this
ID
are accessed. However, the
IDs
of a
chart
,
button
and
shifter
, respectively, do not interfere. At call
of the function, the XY diagram of value
Var
is activated. Values from the field 1...30 can be
represented. 0 means no representation, values greater than 30 are illegal and are interpreted as 0.
At every call of the function, the values are displayed starting from the left. When the end is reached
after 47 calls, the values are shifted to the left. The x-axis label is specified by the arguments
X1, X2
(data type c14) and can be adjusted at runtime.
Thus, our application program reads as follows:
[EibPC]
// Webserver
if stime(0) then webdisplay(21,settime(),CLOCK,INACTIVE,GREY) endif
if stime(0) then webdisplay(22,setdate(),CLOCK,INACTIVE,GREY) endif
// Display of the living room temperature
if cycle(30,0) then webchart(10,convert(8.5*("RkLivingroomTemp-3/1/28"-16.0),0), $-25h$c14,$now$c14)
endif
// Set timeswitch
TimeswitchH=0
TimeswitchM=0
if webbutton(6)==1 then TimerH=1 endif
if webbutton(6)==2 then TimerH=TimerH-1 endif
if webbutton(6)==3 then TimerM=1 endif
if webbutton(6)==4 then TimerM=TimerM-1 endif
if TimerH>23 then TimerH=0 endif
if TimerM>59 then TimerM=0 endif
if change(TimerM) or change(TimerH) then \\
webdisplay(0,convert(TimerH,$$c14)+$:$c14+convert(TimerM,\\
$$c14),DOWN,INACTIVE,GREEN) endif
// Weather station
if stime(0) then webdisplay(2,"RkLivingroomTemp-3/1/28",TEMPERATURE,DISPLAY,GREY) endif
if stime(0) then webdisplay(3,"ThermeExternalTemperature-3/3/13",TEMPERATURE,DISPLAY,GREY) endif
if stime(0) then webdisplay(4,"Wind-3/5/1",WIND,DISPLAY,GREY) endif
if stime(0) then webdisplay(5,"Light-3/5/2",WEATHER,DISPLAY,GREY) endif
// Light switch
if webbutton(30)==1 then if "WorkroomLight-1/1/16" then write("WorkroomLight-1/1/16",AUS) endif; \\
if !"WorkroomLight-1/1/16"
then write("WorkroomLight-1/1/16",EIN) endif \\
endif
if "WorkroomLight-1/1/16" then webdisplay(30,$ON$c14,LIGHT,ACTIVE,GREY) else \\
webdisplay(30,$OFF$c14,LIGHT,INACTIVE,GREY) endif
HandbuchEibPC_USA-30.odt, 2017-05-11
Enertex
®
Bayern GmbH - Erlachstraße 13 - 91301 Forchheim - [email protected]