Editing
Position sensor
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
[[File:Sensor-Position.svg|right]] The Smart Sense position sensor will indicate rotational movement over a 360° range. The sensor connects to any one of the analogue sensor inputs. Once connected the Smart Move software will display the name of the sensor and label the appropriate input ‘Position’. The screen will display the current reading from the sensor, a complete rotation of the spindle will cover the range from 0 to 255. The reading can be converted to degrees by multiplying by 1.41. i.e. PRINT POSITION * 1.41 == Responding to position == The sensor can be used as an input device to a system which responds to changes in position. The example procedure "Compass" uses the sensor to produce an electronic ‘compass’. One of the outputs will switch on as the sensor moves through each quarter of a turn. === Procedure: Compass === REPEAT IF POSITION >= 0 AND POSITION <=63 THEN SWITCH ON 0 ELSE SWITCH OFF 0 IF POSITION >= 64 AND POSITION <=127 THEN SWITCH ON 1 ELSE SWITCH OFF 1 IF POSITION >= 128 AND POSITION <=191 THEN SWITCH ON 2 ELSE SWITCH OFF 2 IF POSITION >= 192 AND POSITION <=255 THEN SWITCH ON 3 ELSE SWITCH OFF 3 FOREVER === How it works === The first and last lines of the procedure form a loop which continues until the user escapes from the procedure. Each line within the loop checks if the sensor reading is within a certain range and switches on or off the appropriate output. == Measuring rotation == The second example uses the sensor to gather data as a pendulum swings. The procedure "Pendulum" will wait until the user presses the space bar. At this point the pendulum should be released and the readings from the sensor are stored to a disk file. Once the pendulum has come to rest the space bar is pressed and the readings are saved to disk. This file can then be used with a spreadsheet to produce results as in the figure. This example compares results from two pendulums of different length. === Procedure: Pendulum === [[File:Chart-Position-Sensor-Pendulum.svg|frameless|right]] FILE 1,"data" WAIT UNTIL GET = 32 PRINT "sampling" REPEAT STORE 1,POSITION UNTIL INKEY = 32 CLOSE 1 [[Category:Sensors]]
Summary:
Please note that all contributions to Smart Box may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Smart Box:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
British English
Views
Read
Edit
View history
More
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information