-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run up to 4 fb360 servos sans jitter (close issues 93 & 94)
Issues closed: servo360 - increase number of servos supported #93 #93 servo360 - remove remove jitter from servo signal #94 #94
- Loading branch information
1 parent
994e8e8
commit 2cee4f8
Showing
25 changed files
with
457 additions
and
80 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
Learn/Examples/Devices/Motor/Servo360/Set Angles 1 servo.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
Set Angles.c | ||
Turns to and holds positions. | ||
Behaves like a standard RC servo when it reaches a given angle. | ||
*/ | ||
|
||
#include "simpletools.h" | ||
#include "servo360.h" | ||
|
||
int main() | ||
{ | ||
// Connect is required before control. The first argument is the I/O pin | ||
// connected to the white control line, and the second is the I/O pin connected | ||
// to the yellow feedback line. | ||
//servo360_connect(12, 14); | ||
servo360_connect(13, 15); | ||
pause(1000); | ||
|
||
//servo360_angle(12, 0); | ||
servo360_angle(13, 0); | ||
pause(1000); | ||
|
||
//servo360_angle(12, 45); | ||
servo360_angle(13, -45); | ||
pause(1500); | ||
|
||
//servo360_angle(12, 360 + 45); | ||
servo360_angle(13, -360 -45); | ||
pause(2500); | ||
|
||
//servo360_angle(12, 0); | ||
servo360_angle(13, 0); | ||
pause(1000); | ||
} |
12 changes: 6 additions & 6 deletions
12
...es/Devices/Motor/Servo360/Set Angles.side → ...es/Motor/Servo360/Set Angles 1 servo.side
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
Set Angles.c | ||
>compiler=C | ||
>memtype=cmm main ram compact | ||
>optimize=-Os | ||
>-m32bit-doubles | ||
Set Angles 1 servo.c | ||
>-fno-exceptions | ||
>defs::-std=c99 | ||
>-lm | ||
>-m32bit-doubles | ||
>BOARD::ACTIVITYBOARD | ||
>compiler=C | ||
>defs::-std=c99 | ||
>memtype=cmm main ram compact | ||
>optimize=-Os |
File renamed without changes.
9 changes: 9 additions & 0 deletions
9
Learn/Examples/Devices/Motor/Servo360/Set Angles 2 servos.side
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Set Angles 2 servos.c | ||
>compiler=C | ||
>memtype=cmm main ram compact | ||
>optimize=-Os | ||
>-m32bit-doubles | ||
>-fno-exceptions | ||
>defs::-std=c99 | ||
>-lm | ||
>BOARD::ACTIVITYBOARD |
42 changes: 42 additions & 0 deletions
42
Learn/Examples/Devices/Motor/Servo360/Set Angles 3 servos.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
Set Angles.c | ||
Turns to and holds positions. | ||
Behaves like a standard RC servo when it reaches a given angle. | ||
*/ | ||
|
||
#include "simpletools.h" | ||
#include "servo360.h" | ||
|
||
int main() | ||
{ | ||
// Connect is required before control. The first argument is the I/O pin | ||
// connected to the white control line, and the second is the I/O pin connected | ||
// to the yellow feedback line. | ||
int s1 = servo360_connect(12, 14); | ||
int s2 = servo360_connect(13, 15); | ||
int s3 = servo360_connect(16, 6); | ||
//int s3 = 0; | ||
print("devcount = %d, s1 = %d, s2 = %d, s3 = %d\r", s1, s2, s3, devCount); | ||
pause(1000); | ||
|
||
servo360_angle(12, 0); | ||
servo360_angle(13, 0); | ||
servo360_angle(16, 0); | ||
pause(1000); | ||
|
||
servo360_angle(12, 45); | ||
servo360_angle(13, -45); | ||
servo360_angle(16, 45); | ||
pause(1500); | ||
|
||
servo360_angle(12, 360 + 45); | ||
servo360_angle(13, -360 -45); | ||
servo360_angle(16, 360 + 45); | ||
pause(2500); | ||
|
||
servo360_angle(12, 0); | ||
servo360_angle(13, 0); | ||
servo360_angle(16, 0); | ||
pause(1000); | ||
} |
9 changes: 9 additions & 0 deletions
9
Learn/Examples/Devices/Motor/Servo360/Set Angles 3 servos.side
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Set Angles 3 servos.c | ||
>compiler=C | ||
>memtype=cmm main ram compact | ||
>optimize=-Os | ||
>-m32bit-doubles | ||
>-fno-exceptions | ||
>defs::-std=c99 | ||
>-lm | ||
>BOARD::ACTIVITYBOARD |
47 changes: 47 additions & 0 deletions
47
Learn/Examples/Devices/Motor/Servo360/Set Angles 4 servos.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
Set Angles.c | ||
Turns to and holds positions. | ||
Behaves like a standard RC servo when it reaches a given angle. | ||
*/ | ||
|
||
#include "simpletools.h" | ||
#include "servo360.h" | ||
|
||
int main() | ||
{ | ||
// Connect is required before control. The first argument is the I/O pin | ||
// connected to the white control line, and the second is the I/O pin connected | ||
// to the yellow feedback line. | ||
int s1 = servo360_connect(12, 14); | ||
int s2 = servo360_connect(13, 15); | ||
int s3 = servo360_connect(16, 6); | ||
int s4 = servo360_connect(17, 7); | ||
//int s3 = 0; | ||
print("devcount = %d, s1 = %d, s2 = %d, s3 = %d, s4 = %d\r", s1, s2, s3, s4, devCount); | ||
pause(1000); | ||
|
||
servo360_angle(12, 0); | ||
servo360_angle(13, 0); | ||
servo360_angle(16, 0); | ||
servo360_angle(17, 0); | ||
pause(1000); | ||
|
||
servo360_angle(12, 45); | ||
servo360_angle(13, -45); | ||
servo360_angle(16, 45); | ||
servo360_angle(17, -45); | ||
pause(1500); | ||
|
||
servo360_angle(12, 360 + 45); | ||
servo360_angle(13, -360 -45); | ||
servo360_angle(16, 360 + 45); | ||
servo360_angle(17, -360 - 45); | ||
pause(2500); | ||
|
||
servo360_angle(12, 0); | ||
servo360_angle(13, 0); | ||
servo360_angle(16, 0); | ||
servo360_angle(17, 0); | ||
pause(1000); | ||
} |
9 changes: 9 additions & 0 deletions
9
Learn/Examples/Devices/Motor/Servo360/Set Angles 4 servos.side
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Set Angles 4 servos.c | ||
>compiler=C | ||
>memtype=cmm main ram compact | ||
>optimize=-Os | ||
>-m32bit-doubles | ||
>-fno-exceptions | ||
>defs::-std=c99 | ||
>-lm | ||
>BOARD::ACTIVITYBOARD |
40 changes: 40 additions & 0 deletions
40
Learn/Examples/Robots/ActivityBot360/Dev/IR Roaming at slower speeds.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
IR Roaming.c | ||
Use IR LED and IR receiver pairs as object detectors for robot roaming. | ||
http://learn.parallax.com/activitybot/roaming-infrared-flashlights | ||
*/ | ||
|
||
#include "simpletools.h" // Library includes | ||
#include "abdrive360.h" | ||
|
||
int irLeft, irRight; // IR variables | ||
|
||
int main() // Main function | ||
{ | ||
low(26); // D/A0 & D/A1 to 0 V | ||
low(27); | ||
|
||
drive_setRampStep(12); // Max step 12 ticks/s every 20 ms | ||
drive_setMaxVelocity(FOR_SPEED, 96); | ||
|
||
|
||
while(1) | ||
{ | ||
freqout(11, 1, 38000); // Check left & right objects | ||
irLeft = input(10); | ||
|
||
freqout(1, 1, 38000); | ||
irRight = input(2); | ||
|
||
if(irRight == 1 && irLeft == 1) // No obstacles? | ||
drive_rampStep(128, 128); // ...full speed ahead | ||
else if(irLeft == 0 && irRight == 0) // Left & right obstacles? | ||
drive_rampStep(-128, -128); // ...full speed reverse | ||
else if(irRight == 0) // Just right obstacle? | ||
drive_rampStep(-128, 128); // ...rotate left | ||
else if(irLeft == 0) // Just left obstacle? | ||
drive_rampStep(128, -128); // ...rotate right | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
Learn/Examples/Robots/ActivityBot360/Dev/IR Roaming at slower speeds.side
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
IR Roaming at slower speeds.c | ||
>compiler=C | ||
>memtype=cmm main ram compact | ||
>optimize=-Os | ||
>-m32bit-doubles | ||
>-fno-exceptions | ||
>defs::-std=c99 | ||
>-lm | ||
>BOARD::ACTIVITYBOARD |
28 changes: 28 additions & 0 deletions
28
Learn/Examples/Robots/ActivityBot360/Dev/Test Encoder Connections (1).c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
Test Encoder Connections.c | ||
Load to ActivityBot EEPROM. PWR to Position 2. | ||
Gently turn each wheel by hand. Right wheel | ||
blinks P27 LED, left wheel blinks P26 LED. | ||
If not, encoders are not seeing wheel spokes. | ||
Go to Extras/Troubleshooting section of tutorial. | ||
http://learn.parallax.com/activitybot/test-encoder-connections | ||
*/ | ||
|
||
#include "simpletools.h" | ||
#include "abdrive360.h" | ||
|
||
int main() | ||
{ | ||
low(26); | ||
low(27); | ||
while(1) | ||
{ | ||
int ticksLeft, ticksRight; | ||
drive_getTicks(&ticksLeft, &ticksRight); | ||
set_output(26, ticksLeft % 2); | ||
set_output(27, ticksRight % 2); | ||
} | ||
} | ||
|
9 changes: 9 additions & 0 deletions
9
Learn/Examples/Robots/ActivityBot360/Dev/Test Encoder Connections (1).side
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Test Encoder Connections (1).c | ||
>compiler=C | ||
>memtype=cmm main ram compact | ||
>optimize=-Os | ||
>-m32bit-doubles | ||
>-fno-exceptions | ||
>defs::-std=c99 | ||
>-lm | ||
>BOARD::ACTIVITYBOARD |
34 changes: 34 additions & 0 deletions
34
Learn/Examples/Robots/ActivityBot360/Dev/drive_goto tests 3 servos.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
Forward Stop Face Right.c | ||
http://learn.parallax.com/activitybot/go-certain-distances | ||
*/ | ||
|
||
|
||
#include "simpletools.h" | ||
#include "abdrive360.h" | ||
|
||
int main() | ||
{ | ||
/* | ||
#ifdef _console_ | ||
console_start(); | ||
suppressFbDisplay = 0; | ||
#endif | ||
*/ | ||
|
||
drive_goto(192, 192); | ||
servo360_connect(16, 6); | ||
servo360_speed(16, 90); | ||
drive_goto(-28, 28); | ||
drive_goto(28 * 2, -28 * 2); | ||
drive_goto(-28, 28); | ||
drive_goto(-192, -192); | ||
servo360_speed(16, -90); | ||
|
||
drive_goto(192, 128); | ||
drive_goto(-192, -128); | ||
drive_goto(128, 192); | ||
drive_goto(-128, -192); | ||
servo360_speed(16, 0); | ||
} |
9 changes: 9 additions & 0 deletions
9
Learn/Examples/Robots/ActivityBot360/Dev/drive_goto tests 3 servos.side
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
drive_goto tests 3 servos.c | ||
>compiler=C | ||
>memtype=cmm main ram compact | ||
>optimize=-Os | ||
>-m32bit-doubles | ||
>-fno-exceptions | ||
>defs::-std=c99 | ||
>-lm | ||
>BOARD::ACTIVITYBOARD |
21 changes: 21 additions & 0 deletions
21
Learn/Examples/Robots/ActivityBot360/Dev/drive_goto tests with setMaxVelocity (1).c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
#include "simpletools.h" | ||
#include "abdrive360.h" | ||
|
||
int main() | ||
{ | ||
drive_setMaxVelocity(FOR_GOTO, 96); | ||
drive_goto(192, 192); | ||
drive_setMaxVelocity(FOR_GOTO, 64); | ||
drive_goto(-28, 28); | ||
drive_goto(28 * 2, -28 * 2); | ||
drive_goto(-28, 28); | ||
drive_goto(-192, -192); | ||
|
||
drive_setMaxVelocity(FOR_GOTO, 32); | ||
|
||
drive_goto(192, 128); | ||
drive_goto(-192, -128); | ||
drive_goto(128, 192); | ||
drive_goto(-128, -192); | ||
} |
9 changes: 9 additions & 0 deletions
9
Learn/Examples/Robots/ActivityBot360/Dev/drive_goto tests with setMaxVelocity (1).side
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
drive_goto tests with setMaxVelocity (1).c | ||
>compiler=C | ||
>memtype=cmm main ram compact | ||
>optimize=-Os | ||
>-m32bit-doubles | ||
>-fno-exceptions | ||
>defs::-std=c99 | ||
>-lm | ||
>BOARD::ACTIVITYBOARD |
20 changes: 20 additions & 0 deletions
20
Learn/Examples/Robots/ActivityBot360/Dev/drive_goto tests with setMaxVelocity.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include "simpletools.h" | ||
#include "abdrive360.h" | ||
|
||
int main() | ||
{ | ||
drive_setMaxVelocity(FOR_GOTO, 96); | ||
|
||
drive_goto(192, 192); | ||
drive_goto(-28, 28); | ||
drive_goto(28 * 2, -28 * 2); | ||
drive_goto(-28, 28); | ||
drive_goto(-192, -192); | ||
|
||
drive_setMaxVelocity(FOR_GOTO, 32); | ||
|
||
drive_goto(192, 128); | ||
drive_goto(-192, -128); | ||
drive_goto(128, 192); | ||
drive_goto(-128, -192); | ||
} |
9 changes: 9 additions & 0 deletions
9
Learn/Examples/Robots/ActivityBot360/Dev/drive_goto tests with setMaxVelocity.side
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
drive_goto tests with setMaxVelocity.c | ||
>compiler=C | ||
>memtype=cmm main ram compact | ||
>optimize=-Os | ||
>-m32bit-doubles | ||
>-fno-exceptions | ||
>defs::-std=c99 | ||
>-lm | ||
>BOARD::ACTIVITYBOARD |
Oops, something went wrong.