Digital Sensors: Difference between revisions

From Smart Box
Jump to navigation Jump to search
(Created page with "The range of digital sensors allow simple on / off conditions to be detected. The sensors are connected between the pairs of red and yellow digital sensor sockets on the top of the box. When the sensor is in its ‘On’ condition the indicator on the box will light. The Smart Move software can detect the condition of the switch as ‘On’ or ‘Off’ or alternatively ‘1’ or ‘0’. Both these Smart Move program lines are valid: IF SENSOR 1 IS ON THEN FORWARD A...")
 
(→‎An example project: Added Macintosh monitor window graphic)
 
(One intermediate revision by the same user not shown)
Line 8: Line 8:
  IF SENSOR 1 = 1 THEN FORWARD A
  IF SENSOR 1 = 1 THEN FORWARD A


A '''Push Switch''' can be used as a manual input device.
<gallery>
The switch is normally ‘Off’ and will be detected as ‘On’ when pressed.
File:Sensor-Push-Switch.svg|A '''Push Switch''' can be used as a manual input device. The switch is normally ‘Off’ and will be detected as ‘On’ when pressed.
 
File:Sensor-Tilt-Switch.svg|A '''Tilt switch''' can be used to detect when an object has moved beyond a particular angle.
A '''Tilt switch''' can be used to detect when an object has moved beyond a particular angle.
File:Sensor-Magnetic-Switch.svg|A '''Magnetic Switch''' will be ‘On’ when a magnet is close to the end.
 
</gallery>
A '''Magnetic Switch''' will be ‘On’ when a magnet is close to the end.


== Making your own sensors ==
== Making your own sensors ==
Line 32: Line 31:
In this example the keyword OFF is changed to OPEN.
In this example the keyword OFF is changed to OPEN.
The [[LABEL|reference section]] gives more details.
The [[LABEL|reference section]] gives more details.
[[File:Monitor-Alarm-Sensor-Labels.png|frame|right|Macintosh monitor window showing labels]]


Type in the following as direct commands
Type in the following as direct commands
Line 60: Line 61:


[[Category:Sensors]]
[[Category:Sensors]]
[[Category:Missing images]]

Latest revision as of 20:45, 25 October 2023

The range of digital sensors allow simple on / off conditions to be detected. The sensors are connected between the pairs of red and yellow digital sensor sockets on the top of the box. When the sensor is in its ‘On’ condition the indicator on the box will light. The Smart Move software can detect the condition of the switch as ‘On’ or ‘Off’ or alternatively ‘1’ or ‘0’. Both these Smart Move program lines are valid:

IF SENSOR 1 IS ON THEN FORWARD A
IF SENSOR 1 = 1 THEN FORWARD A

Making your own sensors[edit]

Any device which completes a circuit between a red and yellow socket on Smart Box can be used as a digital sensor. This can be as simple as two contacts closing together. Switches can be manufactured using card and tin foil, pegs and drawing pins etc.

An example project[edit]

The following example uses three digital sensors and a buzzer to create a simple security system.

Sensors 0 and 1 are magnetic contact switches which will open as a door or window is opened. A push switch is connected to sensor 2 which is used to switch off the system. The Digital sensors can be ‘Labelled’ or given an alternative name using the LABEL command in Smart Move. This makes the sensors easier to identify. In the same way some of the Smart Move keywords can be changed. In this example the keyword OFF is changed to OPEN. The reference section gives more details.

Macintosh monitor window showing labels

Type in the following as direct commands

LABEL OFF open
LABEL SENSOR0 door
LABEL SENSOR1 window
LABEL SENSOR2 turnoff
LABEL OUTPUT0 buzzer

Type in all the procedures as shown then run the Alarm procedure.

Procedure: Alarm[edit]

REPEAT
IF DOOR IS OPEN THEN Soundalarm
IF WINDOW IS OPEN THEN Soundalarm
UNTIL TURNOFF IS ON
Stopalarm

Procedure: Soundalarm[edit]

SWITCH ON buzzer PULSE 50,50

Procedure: Stopalarm[edit]

SWITCH OFF buzzer