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 0:8ba886befbee, committed 2018-10-28
- Comitter:
- Sraddha
- Date:
- Sun Oct 28 14:17:00 2018 +0000
- Commit message:
- aaa
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sun Oct 28 14:17:00 2018 +0000
@@ -0,0 +1,28 @@
+#Control Servo position with PWM
+
+#include "mbed.h"
+PwmOut servo(p7);
+int main() {
+ for(float i = 0; i <= 1; i = i + 0.25)
+ {
+ servo = i;
+ wait(0.02);
+ }
+ while(1);
+}
+
+#LDR
+
+#include "mbed.h"
+DigitalOut myled(LED1);
+AnalogIn ldr(p20);
+Serial pc(USBTX, USBRX);
+PwmOut servo(p5);
+int main() {
+ servo.period_ms(20);
+ while(1)
+ { pc.printf("%.2f\n\r", ldr*180);
+ servo.pulsewidth_us(1500+ldr*1500);
+ wait(0.1);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Oct 28 14:17:00 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/e95d10626187 \ No newline at end of file