<?xml-stylesheet type="text/xsl" href="https://community.element14.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Arduino using hall effect sensor and servo</title><link>/products/arduino/b/blog/posts/arduino-using-hall-effect-sensor-and-servo</link><description>I am trying to use a hall effect sensor to activate a servo. I want the servo to move to a specific position when the hall effect sensor is activated and then move back when the sensor is deactivated. When I go to the analog read and look at the valu</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Arduino using hall effect sensor and servo</title><link>https://community.element14.com/products/arduino/b/blog/posts/arduino-using-hall-effect-sensor-and-servo</link><pubDate>Thu, 26 Apr 2012 08:26:37 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:37a1a124-0871-466c-9792-36dd1d212832</guid><dc:creator>Former Member</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;You havnt add constrain and mapping properly. Try this code:&lt;/p&gt;&lt;p&gt;#include &amp;lt;Servo.h&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Servo myservo;&amp;nbsp; &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;int inPin = 0;&amp;nbsp;&amp;nbsp; &lt;/p&gt;&lt;p&gt;int val;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;void setup()&lt;/p&gt;&lt;p&gt;{&lt;/p&gt;&lt;p&gt;&amp;nbsp; myservo.attach(9); &lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;void loop()&lt;/p&gt;&lt;p&gt;{&lt;/p&gt;&lt;p&gt;&amp;nbsp; val = analogRead(inPin);&lt;/p&gt;&lt;p&gt;&amp;nbsp; val = constrain(val, 0, 275);&amp;nbsp; &lt;/p&gt;&lt;p&gt;&amp;nbsp; val = map(val, 0, 300, 0, 180);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/p&gt;&lt;p&gt;&amp;nbsp; myservo.write(val);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/p&gt;&lt;p&gt;&amp;nbsp; delay(25);&amp;nbsp; &lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=13852&amp;AppID=145&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Arduino using hall effect sensor and servo</title><link>https://community.element14.com/products/arduino/b/blog/posts/arduino-using-hall-effect-sensor-and-servo</link><pubDate>Sat, 21 Apr 2012 12:45:18 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:37a1a124-0871-466c-9792-36dd1d212832</guid><dc:creator>Former Member</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;If you looking for help on this it would be better to post this as a new discussion rather then a blog post. &lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=13852&amp;AppID=145&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item></channel></rss>