-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfirgelli-linearact-test3.c
64 lines (54 loc) · 1.53 KB
/
firgelli-linearact-test3.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
* $Id: firgelli-linearact-test3.c 133 2013-03-10 15:15:38Z xander $
*/
/**
* firgelli-linearact.h provides an API for the Firgelli Linear Actuator. This program
* demonstrates how to use that API.
*
* Changelog:
* - 0.1: Initial release
*
* TODO:
* - Add ramping support (being worked on, has a few bugs)
*
* Credits:
* - Big thanks to Firgelli for providing me with a Linear Actuator to play with!
*
* License: You may use this code as you wish, provided you give credit where it's due.
*
* THIS CODE WILL ONLY WORK WITH ROBOTC VERSION 3.59 AND HIGHER.
* Xander Soldaat (xander_at_botbench.com)
* 15 february 2010
* version 0.1
*/
#include "drivers/firgelli-linearact.h"
task main () {
tMotor testMotor = motorA;
PlaySound(soundBeepBeep);
nxtDisplayBigTextLine(3, "Retract");
FLACretractLA(testMotor, 100);
wait1Msec(500);
// This stops the motor, handy in case of emergencies
FLACstopLA(motorA);
while(!isDone(testMotor)) wait1Msec(50);
wait1Msec(200);
nMotorEncoder[testMotor] = 0;
wait1Msec(1000);
PlaySound(soundBeepBeep);
eraseDisplay();
nxtDisplayBigTextLine(1, "Extend");
nxtDisplayTextLine(3, "ticks: 40");
nxtDisplayTextLine(4, "speed: 50");
FLACextendLA(testMotor, 50, 40);
while(!isDone(testMotor)) wait1Msec(50);
if (isStalled(testMotor))
nxtDisplayTextLine(7, "STALLED");
wait1Msec(1000);
PlaySound(soundBeepBeep);
eraseDisplay();
nxtDisplayBigTextLine(1, "Done");
wait1Msec(2000);
}
/*
* $Id: firgelli-linearact-test3.c 133 2013-03-10 15:15:38Z xander $
*/