View Full Version : how can i check if there is a sensor or motor

11-06-2011, 02:27 AM
hello my question is general and i am beginner. when i am making a robot, how can i check if there is a sensor working? or a motor is working? also, how can i check if there is an input that the sound sensor received? i dont have robot yet . can you provide simple code example? i am trying to understand the basics.

11-25-2011, 11:33 PM
I will need a bit more information before I can help out. What is your micro-controller and or hardware interface? As for testing motors just connect them to some form of power ie 9v battery for a large motor or AAA for a small motor.

It would help to know a lot more about your project including what sensors or motors you are using ect...

11-26-2011, 01:20 AM
i have none. i am trying to understand the basic. give me a very simple example about it if you could. how can you check if a sensor or motor exist.

11-26-2011, 02:56 PM
Wow, well there is nothing basic about it :) but I will try and help you out... When you say checking if a sensor or motor exists what dose that mean? Its a fairly ambiguous statement the problem being check if they exist to what? To a computer, a micro-controller, a human? Also the term exist itself is ambiguous dose that mean get input from or just check weather it is connected or not; the code and setup for any of these varies greatly form devise to devise. It would be smart to approach your first creation of a robot using a tried and true design so that you lean the basics from structured tutorials and plans instead of just launching into it, there is no one right way to build a robot it all depends on what you want to do so there is no general example I could give you with the minimal information I have.

Check this tutorial out and maybe it will give you a starting place http://letsmakerobots.com/start .

Here is a basic example of how I would check if motors and sensors existed for the sake of answering your question:

Start with an arduino (http://arduino.cc/) a motor with an encoder and a bump sensor "aka a button or momentary switch" .
Sudo code for the micro-controller would look like this:

spin motor;
check encoder input;
if encoder moves
pint motor exists;
check bump sensor;
if bump sensor pressed
print sensor exists;
goto start;