11 years, 2 months ago.

IR sensor and servo motor to the mbed nxp lpc 1678

Hi there

I've got all components here. It is IR distance sensor, servo motor and microcontroller nxp lpc 1678. Here is the only problem that I dunno how to write the code to connect these three things together. Could u please help me out?

Thanks in advance

4 Answers

11 years, 2 months ago.

I want to do is when my hand is close to sensor, the servo motor will turn to 90 degrees /media/uploads/Olzhas/dsc_1570.jpg

Accepted Answer

oh youre using a sharp IR sensor if im correct well u have to do something like this

  • connect the signal sensor to one of the analogIn mbed pins (in the picture i assume is the yellow cable)
  • Create an AnalogIn object with the pin
  • Connect your servo signal pin to one of the PWMOut Pins in the mbed
  • Make use of the Servo Library to controlling the position of the servo when you detect a voltage in the signal pin of the IR Sensor

Greetings

posted by Ney Palma 28 Sep 2013
11 years, 2 months ago.

I have interface the same IR sensor but it always providing logic High! can you tell what is problem

11 years, 2 months ago.

Hi Olzhas, what exactly you want to do with those components? Can you put an image of the ir sensor and servo youre using?

Greetings

11 years, 2 months ago.

Have you connected the sensor and the servo to the mbed?

If you have, then I suggest you read and try out the following libraries.

http://mbed.org/handbook/PwmOut http://mbed.org/handbook/AnalogIn

thanks a lot

posted by Olzhas Kurikov 29 Sep 2013