Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
6 years, 6 months ago.
Help with accelerometer
Hello everyone,
I'm new to the mbed systems and I need help writing a code for my freedom board to make the accelerometer provide digital input to the pins in order to control a DC motor with a H bridge. For example, I have found a code on the forums where the LED turns green when you move the board on the x-axis, red when the board is moved on the y-axis, and blue when the board is moved on the z-axis. I need help trying to get it to the pins instead of the LED so when I tilt it to the x-axis the motor moves clockwise by having a low and high input to the H Bridge. When tilting it to the y-axis, I would like it to have a high and low input or a counterclockwise motion.
1 Answer
6 years, 6 months ago.
Hi Antonios,
You should be able to accomplish this by using DigitalOut. You will just have to create a couple of DigitalOut objects with the correct PinNames or PinNumbers.
https://os.mbed.com/docs/v5.8/reference/digitalout.html