Skip to content

Commit ae4d0d2

Browse files
committed
updated example
1 parent 1d5a33a commit ae4d0d2

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

examples/position/position.ino

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
1010
*/
1111

12-
// WIP
1312

1413
#include "Arduino_AlvikCarrier.h"
1514

@@ -19,26 +18,23 @@ unsigned long tmotor=0;
1918
unsigned long ttask=0;
2019
uint8_t task=0;
2120
float reference;
22-
float position;
2321

2422
void setup() {
2523
Serial.begin(115200);
2624
alvik.begin();
27-
ttask = millis();
28-
tmotor = millis();
2925
task = 0;
3026
reference = 0;
31-
position = 0;
27+
ttask = millis();
28+
tmotor = millis();
3229
}
3330

3431
void loop() {
3532
if (millis()-tmotor>20){
3633
tmotor = millis();
3734
alvik.updateMotors();
38-
position = alvik.motor_control_left->getPosition();
3935
Serial.print(reference);
4036
Serial.print("\t");
41-
Serial.print(position);
37+
Serial.print(alvik.getPositionLeft());
4238
Serial.print("\n");
4339
}
4440

@@ -76,10 +72,10 @@ void loop() {
7672
reference = 10;
7773
break;
7874
}
79-
alvik.motor_control_left->setPosition(reference);
75+
alvik.setPositionLeft(reference);
8076
task++;
8177
if (task>9){
82-
task=0;
78+
task = 0;
8379
}
8480
}
8581

0 commit comments

Comments
 (0)