ezeio2:scriptref:start

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
ezeio2:scriptref:start [2021-09-24 00:30] andrehezeio2:scriptref:start [2026-01-23 21:51] (current) andreh
Line 12: Line 12:
 We strongly recommend reading the following documents to get introduced to the PAWN language: We strongly recommend reading the following documents to get introduced to the PAWN language:
  
-[[https://github.com/compuphase/pawn/raw/master/doc/Pawn_Getting_Started.pdf|Introduction to PAWN]]+[[https://doc.eze.io/_media/ezeio2/pawn_getting_started.pdf|Introduction to PAWN]]
  
-[[https://github.com/compuphase/pawn/raw/master/doc/Pawn_Language_Guide.pdf|PAWN language guide]]+[[https://doc.eze.io/_media/ezeio2/pawn_language_guide.pdf|PAWN language guide]]
  
  
Line 108: Line 108:
  
 <code javascript> <code javascript>
 +new @Speed;
 +
 main() main()
 { {
Line 116: Line 118:
 { {
     new Float:temp, Float:diff; // Declare "float" variables to handle fractions     new Float:temp, Float:diff; // Declare "float" variables to handle fractions
 +    new sp = 0;                 // Use sp to find the resulting speed
          
     temp = GetFieldFloat(1);    // Fetch the current temperature from Field 1     temp = GetFieldFloat(1);    // Fetch the current temperature from Field 1
     diff = temp - 20.5;         // 20.5 is our setpoint. diff is the differece     diff = temp - 20.5;         // 20.5 is our setpoint. diff is the differece
          
-    if(diff > 0.0)              // Over setpoint?+    if(diff > 0.0) {            // Over setpoint?
         SetOutput(1, 100);      // ..yes, so enable low speed         SetOutput(1, 100);      // ..yes, so enable low speed
 +        sp++;                   // count up our speed result
 +    }
     else     else
         SetOutput(1, 0);        // ..no, so shut off         SetOutput(1, 0);        // ..no, so shut off
                  
-    if(diff > 2.0)              // 2 degrees or more over setpoint?+    if(diff > 2.0) {            // 2 degrees or more over setpoint?
         SetOutput(2, 100);      //..yes, so enable mid-speed         SetOutput(2, 100);      //..yes, so enable mid-speed
 +        sp++;                   // count up our speed result
 +    }
     else     else
         SetOutput(2, 0);         SetOutput(2, 0);
  
-    if(diff > 6.0)              // 6 degrees or more over setpoint?+    if(diff > 6.0) {            // 6 degrees or more over setpoint?
         SetOutput(3, 100);      //..yes, so run full speed         SetOutput(3, 100);      //..yes, so run full speed
 +        sp++;                   // count up our speed result
 +    }
     else     else
         SetOutput(3, 0);         SetOutput(3, 0);
 +        
 +    @Speed = sp;                // Make the speed available to expressions as "@Speed".
 } }
 </code> </code>
  • ezeio2/scriptref/start.1632443407.txt.gz
  • Last modified: 2021-09-24 00:30
  • by andreh