Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| ezeio2:scriptref:start [2021-09-24 00:30] – andreh | ezeio2: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/ | + | [[https://doc.eze.io/_media/ezeio2/pawn_getting_started.pdf|Introduction to PAWN]] |
| - | [[https://github.com/compuphase/pawn/ | + | [[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 " | new Float:temp, Float:diff; // Declare " | ||
| + | new sp = 0; // Use sp to find the resulting speed | ||
| | | ||
| temp = GetFieldFloat(1); | temp = GetFieldFloat(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) { |
| SetOutput(1, | SetOutput(1, | ||
| + | sp++; // count up our speed result | ||
| + | } | ||
| else | else | ||
| SetOutput(1, | SetOutput(1, | ||
| | | ||
| - | if(diff > 2.0) // 2 degrees or more over setpoint? | + | if(diff > 2.0) { |
| SetOutput(2, | SetOutput(2, | ||
| + | sp++; // count up our speed result | ||
| + | } | ||
| else | else | ||
| SetOutput(2, | SetOutput(2, | ||
| - | if(diff > 6.0) // 6 degrees or more over setpoint? | + | if(diff > 6.0) { |
| SetOutput(3, | SetOutput(3, | ||
| + | sp++; // count up our speed result | ||
| + | } | ||
| else | else | ||
| SetOutput(3, | SetOutput(3, | ||
| + | | ||
| + | @Speed = sp; // Make the speed available to expressions as " | ||
| } | } | ||
| </ | </ | ||