Examples

Here you’ll find the standard demonstration examples, showing how to use many aspects of the ‘mIoTa’.

Sending UDP network packets

sub ToggleRedLed;
  RedLed=not(RedLed);
  if RedLed=1 then
    UDP1TxTestStr='RedOn'
  else
    UDP1TxTestStr='RedOff';
  UDP_SEND(1,UDP1TxTestStr);
subend;

sub ToggleBlueLed;
  BlueLed=not(BlueLed);
  if BlueLed=1 then
    UDP1TxTestStr='BlueOn'
  else
    UDP1TxTestStr='BlueOff';
  UDP_SEND(1,UDP1TxTestStr);
subend;

Setting Servo Positions

mymac = &00:05:4F:80:00:FF;
myip = @192.168.0.1;
myrom = #28E3D1E302000073;

case FunctionNumber
  is 0  then callsub selected;
  is 1  then FunctionStr = TIMESTR;
  is 2  then FunctionStr = DATESTR;
  is 16 then if (DCHPEnabled=1) then 
       begin
         FunctionStr ='checked';
         u39='0';
       end;   
  is 40 then callsub Get_LCD_Line;
caseend;  


sub IsScanFinished;
  if Wf_SCANFINISHED = false then
    FunctionStr = '1'
  else
    FunctionStr = '0';  
subend;

sub selected;
  u3 = httpfilename + '.' + httpextension;
  if (FunctionNumArgs<>1) then exit;
  case FunctionIndex
    is 0 then if (FunctionArg0 <> DO1) then exit; 
    is 1 then if (FunctionArg0 <> DO2) then exit; 
    is 2 then if (FunctionArg0 <> DO3) then exit; 
    is 3 then if (FunctionArg0 <> DO4) then exit; 
    is 4 then if (FunctionArg0 <> DO5) then exit; 
    is 5 then if (FunctionArg0 <> DO6) then exit; 
    is 6 then if (FunctionArg0 <> DO7) then exit; 
    is 7 then if (FunctionArg0 <> DO8) then exit;
  caseend;   
  FunctionStr = 'selected';
subend;


sub Get_LCD_Line;
  if (FunctionIndex > 0) or (FunctionIndex < 9) then 
    FunctionStr = LCD_GetLine(1, FunctionIndex); 
subend;