Software that allows basic remote control of the position of a servo (schematic included in the comments)
Fork of Nucleo_sg90_remote_control by
Diff: main.cpp
- Revision:
- 6:6e9120cf5640
- Parent:
- 5:78a94312c383
- Child:
- 7:db4f43c3ae10
--- a/main.cpp Thu Mar 23 19:44:48 2017 +0000 +++ b/main.cpp Fri Mar 24 18:14:46 2017 +0000 @@ -51,8 +51,6 @@ DigitalOut userLED(LED1); PwmOut towerProSG90(D11); -PwmOut remoteControlOutput(D10); -PwmOut modulatingOutput(D9); InterruptIn userButton(USER_BUTTON); int index; int pulseDurationInMicroSeconds[]= @@ -65,7 +63,6 @@ index = 0; } towerProSG90.pulsewidth_us(pulseDurationInMicroSeconds[index]); - remoteControlOutput.pulsewidth_us(PWM_PERIOD_FOR_SG90_IN_MS*1000 - pulseDurationInMicroSeconds[index]); } int main() @@ -73,10 +70,6 @@ index = 0; towerProSG90.period_ms(PWM_PERIOD_FOR_SG90_IN_MS); towerProSG90.pulsewidth_us(pulseDurationInMicroSeconds[index]); - remoteControlOutput.period_ms(PWM_PERIOD_FOR_SG90_IN_MS); - remoteControlOutput.pulsewidth_us(PWM_PERIOD_FOR_SG90_IN_MS*1000 - pulseDurationInMicroSeconds[index]); - modulatingOutput.period_us(PWM_PERIOD_FOR_MODULATION_IN_US); - modulatingOutput.pulsewidth_us(PWM_PERIOD_FOR_MODULATION_IN_US/2); userButton.fall(&responseToUserButtonPressed); userLED = 1; @@ -84,8 +77,7 @@ { userLED = !userLED; - int delai = 0; - delai = probe.convertTemperature(true, DS1820::all_devices); //Start temperature conversion, wait until ready + probe.convertTemperature(true, DS1820::all_devices); //Start temperature conversion, wait until ready printf("Il fait: %3.1foC\r\n", probe.temperature()); wait(1.25); }