Writing Joystick Code: Part 1: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 91: Line 91:
Throttle, propeller-pitch, mixture and carburetor-heat.  
Throttle, propeller-pitch, mixture and carburetor-heat.  


These do not have optional settings, after all you want a smooth linear response. This is the code for the throttle control, for the others, just replace throttle with propeller, mixture or carbHeat.
These do not have optional settings, after all you want a smooth linear response. This is the code for the throttle control, for the others, just replace throttleAxis with propellerAxis, mixtureAxis or carbHeatAxis.


   <axis n="2">
   <axis n="2">
Line 102: Line 102:


Here, the "instructions" we give are in the Nasal language, so we have  
Here, the "instructions" we give are in the Nasal language, so we have  
   <command>nasal</command> to let the interpretter know.
   <command>nasal</command> to let the interpreter know.


The actual "instruction" is between the <script> and </script> tags.
The actual "instruction" is between the <script> and </script> tags.
Line 145: Line 145:
   </script>
   </script>


Note that all lines except the last have a ; at the end. This lets the interpretter know that you haven't finished yet.
Note that all lines except the last have a ; at the end. This lets the interpreter know that you haven't finished yet.




Line 236: Line 236:
   4. By using comments and open lines, the block of code is a lot less daunting. In fact, once you have grasped the basics, it is quite easy to read.
   4. By using comments and open lines, the block of code is a lot less daunting. In fact, once you have grasped the basics, it is quite easy to read.


Anything that starts with # is ignored by the interpretter, even if it comes after some code. Such as
Anything that starts with # is ignored by the interpreter, even if it comes after some code. Such as
   <script>controls.throttleAxis</script> # Controls the throttle axis
   <script>controls.throttleAxis</script> # Controls the throttle axis


224

edits

Navigation menu