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
Turret_move.cpp
- Committer:
- LanierUSNA16
- Date:
- 2015-03-03
- Revision:
- 2:1ef6c6f5dfe1
- Parent:
- 1:f60fe84699b4
- Child:
- 3:ab87f97bfa06
File content as of revision 2:1ef6c6f5dfe1:
#include "mbed.h"
PwmOut turret_speed(p21);
DigitalOut turret_direction(p22);
int main()
{
int input_dc =50;
int user_direction = 0;
float duty_cycle = 0.6;
while(1)
{
printf("Enter duty cycle, 0 to 100:\n");
scanf("%d", &input_dc);
duty_cycle = input_dc/100.0;
printf("%f duty cycle set. Enter 0 for CCW or 1 for CW spin direction:\n",duty_cycle);
scanf("%d", &user_direction);
turret_speed = duty_cycle;
turret_direction = user_direction;
printf("%f duty cycle. %d spin.\n", duty_cycle, user_direction);
}
}