Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 3:91070e0c0431, committed 2017-03-08
- Comitter:
- YPROY
- Date:
- Wed Mar 08 23:15:42 2017 +0000
- Parent:
- 2:7aacbdf39425
- Commit message:
- Limit index counter to NUMBER_OF_POSITIONS - 1
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Jan 30 12:29:00 2017 +0000
+++ b/main.cpp Wed Mar 08 23:15:42 2017 +0000
@@ -22,9 +22,13 @@
DigitalOut userLED(LED1);
PwmOut towerProSG90(D11);
+PwmOut testOutput(D10);
InterruptIn userButton(USER_BUTTON);
int index;
-int pulseDurationInMicroSeconds[]={700, 1550, 2500, 1550};
+int pulseDurationInMicroSeconds[]=
+// {10, 1500, 1750, 2000, 1750, 1500, 10, 1500, 1250, 1000, 1250, 1500};
+ {1500,1625,1750,1875,2000, 1875,1750,1625,1500,1375,1250,1125,1000,1125,1250,1375};
+//{700, 1550, 2500, 1550}
void responseToUserButtonPressed(void)
{
index++;
@@ -33,6 +37,7 @@
index = 0;
}
towerProSG90.pulsewidth_us(pulseDurationInMicroSeconds[index]);
+ testOutput.pulsewidth_us(20000 - pulseDurationInMicroSeconds[index]);
}
int main()
@@ -40,6 +45,8 @@
index = 0;
towerProSG90.period_ms(PWM_PERIOD_FOR_SG90_IN_MS);
towerProSG90.pulsewidth_us(pulseDurationInMicroSeconds[index]);
+ testOutput.period_ms(PWM_PERIOD_FOR_SG90_IN_MS);
+ testOutput.pulsewidth_us(20000 - pulseDurationInMicroSeconds[index]);
userButton.fall(&responseToUserButtonPressed);
while(1)