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.
Diff: main.cpp
- Revision:
- 1:08bf7339efdd
- Parent:
- 0:ef8775413c37
- Child:
- 2:2cc5d274f30d
--- a/main.cpp Fri Oct 21 12:42:39 2016 +0000
+++ b/main.cpp Fri Oct 21 13:17:57 2016 +0000
@@ -5,7 +5,7 @@
PwmOut ServoPWMpin(D7);
char Key;
-float ServoAngle = 0;
+float ServoAngle = 89 ;
float Pulsew = 0.0015;
const float Frequency = 10;
@@ -21,23 +21,23 @@
switch(Key) { //Check to see which Key key...
case 0x41: //It was the UP Key key...
pc.printf("\n\r UP!");
- if( ServoAngle < 90){
- ServoAngle = ServoAngle+1;
+ if( ServoAngle < 80){
+ ServoAngle = ServoAngle+10;
}
break;
case 0x42: //It was the DOWN Key key...
pc.printf("\n\r DOWN!");
- if( ServoAngle > -90){
- ServoAngle = ServoAngle-1;
+ if( ServoAngle > 1){
+ ServoAngle = ServoAngle-10;
}
break;
case 0x20:
pc.printf("\n\r SPACE!");
- if( ServoAngle == 0){
- ServoAngle = 90;
+ if( ServoAngle < 45){
+ ServoAngle = 89;
}
else{
- ServoAngle = -ServoAngle;
+ ServoAngle = 1;
}
break;
}