MORE PROGRAMMING
V. Ryan © 2002
Programing is straightforward when using an interface like the ‘Smart Box’. The smart box uses software called ‘Smart Move’. The commands are simple and usually easy to follow. Plan your program with a flow chart first (see previous notes). Remember, computers have to be told every move, treat them as if they are completely unintelligent. |
|||
To load your program, type LOAD MYPROG. You will see that both procedures are loaded, SENSOR and LIGHTS. If you type the name of the first procedure the computer will carry out the commands from the sensor procedure and then from the lights procedure. |
|||
Why do you think
the first procedure is called a ‘LOOP’ ?
|
Why do you think
the second procedure is called a ‘SUB-ROUTINE’ ?
|
||
|
|||
FEEDBACK |
|||
When a sensor such as a temperature or light sensor is
connected to an interface it feeds back data - the temperature of light
level. Programs can be written to continually check for an increase or
decrease in temperature or light. This is called FEEDBACK. Feedback can be
used to control motors and other devices. For example, a light sensor may
read the light level and when the sun becomes too bright a motor may be
switched on which lowers a curtain on a window. |
|||
Give an example
of how a switch can be used to provide feedback.
|
|||
|
|||