Skip to content

Commit

Permalink
Merge pull request #3 from arduino-libraries/servo
Browse files Browse the repository at this point in the history
added RC servos in firmware_01 example
  • Loading branch information
gbr1 authored Jan 24, 2024
2 parents bb78c3c + 685d2c0 commit 887737b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
26 changes: 21 additions & 5 deletions examples/firmware_01/firmware_01.ino
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,18 @@ SensorTofMatrix tof(alvik.wire, EXT_GPIO3, EXT_GPIO2);
ucPack packeter(200);

uint8_t code;
uint8_t label;
uint8_t control_type;
uint8_t msg_size;


unsigned long tmotor=0;
unsigned long tsend=0;
unsigned long tsensor=0;
unsigned long timu=0;


float left, right;
float left, right, value;
uint8_t leds;

uint8_t sensor_id = 0;
Expand All @@ -40,6 +43,7 @@ uint8_t sensor_id = 0;
uint8_t pid;
float kp, ki, kd;

uint8_t servo_A, servo_B;


void setup(){
Expand Down Expand Up @@ -75,11 +79,24 @@ void loop(){
packeter.unpacketC2F(code,left,right);
alvik.setRpm(left, right);
break;
/*
case 'W':
packeter.unpacketC2B1F(code,label,control_type,value);
if ((label == 'L') && (control_type == 'V')) {
alvik.motor_control_left->setRPM(value);
}
else if ((label == 'R') && (control_type == 'V'))
{
alvik.motor_control_right->setRPM(value);
}

break;

case 'S':
alvik.setRpm(0,0);
packeter.unpacketC2B(code,servo_A,servo_B);
alvik.setServoA(servo_A);
alvik.setServoB(servo_B);
break;
*/

case 'L':
packeter.unpacketC1B(code,leds);
alvik.setAllLeds(leds);
Expand Down Expand Up @@ -135,7 +152,6 @@ void loop(){
if (millis()-tmotor>20){
tmotor=millis();
alvik.updateMotors();
alvik.updateImu();
msg_size = packeter.packetC2F('j', alvik.getRpmLeft(),alvik.getRpmRight());
alvik.serial->write(packeter.msg,msg_size);

Expand Down
4 changes: 2 additions & 2 deletions library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Arduino Alvik Carrier
version=0.1.0
version=0.1.1
author=Arduino, Giovanni di Dio Bruno, Lucio Rossi
maintainer=Arduino <[email protected]>
sentence=Library and firmware for Arduino Alvik Carrier board
Expand All @@ -8,4 +8,4 @@ category=Robotics
url=https://github.com/arduino-libraries/Arduino_AlvikCarrier
architectures=stm32
includes=Arduino_AlvikCarrier.h
depends=Arduino_APDS9960, Arduino_MAX17332, STM32duino_LSM6DSO, STM32duino_MotionFX, STM32duino_VL53L7CX, AT42QT, ucPack
depends=Arduino_APDS9960, Arduino_MAX17332, STM32duino_LSM6DSO, STM32duino_MotionFX, STM32duino_VL53L7CX, AT42QT, ucPack

0 comments on commit 887737b

Please sign in to comment.