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.
Dependencies: mbed
Diff: Turret_move.cpp
- Revision:
- 0:e8b029305469
- Child:
- 1:f60fe84699b4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Turret_move.cpp Tue Mar 03 13:36:47 2015 +0000
@@ -0,0 +1,33 @@
+#include "mbed.h"
+PwmOut turret_speed(p21);
+DigitalOut turret_direction(p22);
+
+float duty_cycle = 0;
+int user_direction = 0;
+
+int main()
+{
+
+while(1)
+{
+printf("Enter duty cycle:");
+scanf("%f", &duty_cycle);
+
+printf("%f duty cycle set. Enter 0 or 1 for spin direction:");
+scanf("%d", &user_direction);
+
+if (duty_cycle< 1.0 && duty_cycle>-1.0)
+ {
+ turret_speed = duty_cycle;
+ turret_direction = user_direction;
+
+ }
+
+ else
+
+ {
+ printf("need to saturate");
+ }
+ }
+ }
+
\ No newline at end of file