![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Sevro_drive
main.cpp
- Committer:
- ajp109
- Date:
- 2021-12-15
- Revision:
- 2:061e2fe8ae1a
- Parent:
- 1:a7c3f3f3f2e7
File content as of revision 2:061e2fe8ae1a:
#include "mbed.h" // Initialise D2 as an OPEN DRAIN output // It can be used in the same way as a normal DigitalOut DigitalInOut sig(D2, PIN_OUTPUT, OpenDrain, 0); int main() { while(true) { for (int pulseWidth = 1000; pulseWidth < 2000; pulseWidth += 10) { // Send servo pulse sig = true; wait_us(pulseWidth); sig = false; // Wait for approx. 20ms thread_sleep_for(20); } } }