Skip to content

Commit

Permalink
Merge pull request #1 from MINDS-i/use-common-libs
Browse files Browse the repository at this point in the history
Update examples; use common libs
  • Loading branch information
agyoungs authored Nov 11, 2024
2 parents 07d37aa + 3b693ab commit 0805649
Show file tree
Hide file tree
Showing 12 changed files with 1,899 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include <Servo.h>

/***************************************************
/ Example provided by MINDS-i
/ Try checking out our arduino resource guide at
/ http://mindsieducation.com/programming-resources
/ Questions? Concerns? Bugs? email [email protected]
/
/ This example is to be used to set the open position
/ of the MINDS-i Sprayer Trailer servos attached to
/ pin 2 and pin 3
/***************************************************/

Servo leftBase, rightBase;

void setup() {
// Defines the pins the servos and ESC are plugged into
leftBase.attach(2);
rightBase.attach(3);

// Sets the starting position for the servos and ESC
leftBase.write(135); //135 closed - 45 open
rightBase.write(45); // 45 closed - 135 open
}

void loop() {
// put your main code here, to run repeatedly:

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#include <MINDS-i-Common.h>
#include <Servo.h>

/***************************************************
/ Example provided by MINDS-i
/ Try checking out our arduino resource guide at
/ http://mindsieducation.com/programming-resources
/ Questions? Concerns? Bugs? email [email protected]
/
/ This example template will change the angle of
/ 2 servos based on the input from the tractor or a
/ RC receiver plugged in to pin 7.
/
/ The tractor will signal the trailer to run the code
/ in "trailerOn" when it reaches a waypoint tagged
/ trailer on. It will in turn run the code in
/ "trailerOff" whenever it reaches a non tagged waypont.
/***************************************************/

namespace minds_i_comms = minds_i_common::comms;

Servo servo1, servo2;

void setup() {
servo1.attach(2);
servo2.attach(3);

servo1.write(90);
servo2.write(90);
}

void loop() {
if (minds_i_comms::getRadio(7) > 90) {
trailerOn();
} else {
trailerOff();
}
}

void trailerOff() {
servo1.write(45);
servo2.write(135);
}

void trailerOn() {
servo1.write(135);
servo2.write(45);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include <MINDSi.h>
#include <MINDS-i-Utils.h>
#include <MINDS-i-Common.h>

/***************************************************
/ Example provided by MINDS-i
Expand Down Expand Up @@ -27,7 +26,10 @@

#define MAX_SERVO_DEGREES_PER_SECOND 500

RateControlledServo servo1, servo2;
namespace minds_i_control = minds_i_common::control;
namespace minds_i_comms = minds_i_common::comms;

minds_i_control::RateControlledServo servo1, servo2;

unsigned long ticks;

Expand All @@ -38,7 +40,7 @@ void setup() {
}

void loop() {
if (getRadio(7) > 90)
if (minds_i_comms::getRadio(7) > 90)
{
trailerOn();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

#include "Encoder.h"

// Yes, all the code is in the header file, to provide the user
// configure options with #define (before they include it), and
// to facilitate some crafty optimizations!

Encoder_internal_state_t* Encoder::interruptArgs[];
Loading

0 comments on commit 0805649

Please sign in to comment.