Presentation is loading. Please wait.

Presentation is loading. Please wait.

THE TOUCH SENSOR The Touch Sensor, shown in the picture, gives the robot the sense of touch. It gives too different signals when the orange part is ether.

Similar presentations


Presentation on theme: "THE TOUCH SENSOR The Touch Sensor, shown in the picture, gives the robot the sense of touch. It gives too different signals when the orange part is ether."— Presentation transcript:

1 THE TOUCH SENSOR The Touch Sensor, shown in the picture, gives the robot the sense of touch. It gives too different signals when the orange part is ether pressed or released.

2 SENSOR HARDWARE SCHEMATIC
The NXT Touch Sensor has only 2 states, pressed (represented by 1) or unpressed (represented by 0). This kind of sensor is called “digital sensor”. The electrical circuit is very simple, as you can see above.

3 What can you do with a Touch Sensor?
The Touch Sensor can be used to: -detect impacts, if mounted forward in the moving direction - to pick up things, thanks to the Touch Sensor the robot can know whether or not there is something in its hand to grab - detect a command. For example, by pressing the Touch Sensor you can make your robot move. The only limit is your fantasy!

4 The input port and the cable have six connections.
Connect the touch sensor to your NXT unit The input port and the cable have six connections. The can be used to get digital, analog and I2C signals and to give power supply the connected sensor.

5 Programming the Touch Sensor with NXC
Not eXactly C, or NXC, is a high-level programming language for the Lego Mindstorms NXT. NXC has a syntax similar to C. Before using a sensor you have to declare its connecting input and type, in our case: SetSensor( port number S1 to S4, SENSOR_TOUCH ); To read a value and store it in a variable: x = Sensor(port number);

6 EXAMPLE PROGRAM task main() { SetSensor( S1, SENSOR_TOUCH );
while( true ) if( Sensor(S1)==0 ) OnFwd(OUT_AB,50); } else OnRev(OUT_AB,50); Wait(500); OnFwd(OUT_A,50);


Download ppt "THE TOUCH SENSOR The Touch Sensor, shown in the picture, gives the robot the sense of touch. It gives too different signals when the orange part is ether."

Similar presentations


Ads by Google