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: Adafruit-16-Ch-PWM-Servo-Driver HCSR04 PID PololuQik2 QEI Sharp mbed-rtos
Fork of theRobot by
Diff: main.cpp
- Revision:
- 5:429e9a998bab
- Parent:
- 4:42460f387701
- Child:
- 6:75259c3306dd
diff -r 42460f387701 -r 429e9a998bab main.cpp
--- a/main.cpp Thu Mar 13 17:10:42 2014 +0000
+++ b/main.cpp Fri Mar 14 22:15:58 2014 +0000
@@ -55,8 +55,10 @@
// POSITION ODER:
// base_rotate, base_arm, lil_arm, int big_arm, int claw_arm, int claw_rotate, int claw_open
- {STORE_POSITION, 900, 900, 900, 900, 900, 900, 900}, // storing position
- {OIL_RIG1, 1500, 1400, 1900, 900, 900, 0, 0}, // point laser at oilrig2
+ {STORE_POSITION, 90, 0, 177, 0, 0, 90, 90}, // storing position
+ {OIL_RIG1, 90, 60, 130, 75, 60, 90, 90}, // point laser at oilrig1
+ {OIL_RIG2, 120, 60, 130, 75, 60, 90, 90}, // point laser at oilrig2
+ {OIL_RIG3, 135, 60, 130, 75, 60, 90, 90}, // point laser at oilrig2
};
@@ -84,9 +86,19 @@
//Servo initialization
initServoDriver();
- // servoBegin(); // initiates servos to start position
+ servoBegin(); // initiates servos to start position
//ServoOutputDisable = 0;
+while(1){
+ //pc.scanf("%d %d", &servoNum, &servoAngle);
+ //setServoPulse(servoNum, servoAngle);
+ pc.scanf("%d", &posNum);
+ servoPosition(posNum);
+
+
+ }
+
+/*
while(1) {
pc.printf("PICK A TEST TO PERFORM\n");
pc.printf("1) Distance Reading\n");
@@ -112,7 +124,7 @@
default:
pc.printf("ERROR: NOT A VALID TEST PROCEDURE");
break;
- }
+ }*/
/*if(pc.readable()) {
@@ -125,8 +137,8 @@
//servoPosition(posNum);
- }*/
- }
+ }
+ }*/
/**************************************************
* FIRST STAGE
@@ -196,10 +208,10 @@
{
pc.printf("Setting Initial Position\n\r");
setServoPulseNo_delay(0, 90);
- setServoPulseNo_delay(1, 90);
- setServoPulseNo_delay(2, 90);
- setServoPulseNo_delay(3, 90);
- setServoPulseNo_delay(4, 90);
+ setServoPulseNo_delay(1, 0);
+ setServoPulseNo_delay(2, 177);
+ setServoPulseNo_delay(3, 0);
+ setServoPulseNo_delay(4, 0);
setServoPulseNo_delay(5, 90);
setGripper(1);
}
