Skip to content
This repository has been archived by the owner on Apr 11, 2019. It is now read-only.

Commit

Permalink
Wrote the beginnings of the pololu msc lib
Browse files Browse the repository at this point in the history
  • Loading branch information
allgood38 committed Feb 2, 2013
1 parent 240f5c1 commit 3b90636
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 2 deletions.
19 changes: 19 additions & 0 deletions PololuServo/pololu_servo.cpp
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,19 @@
#include "pololu_servo.h"

PololuMSC::PololuMSC(Stream* serialIn, int reset_pin) {
this->serialCom = serialIn;
this->reset_pin = reset_pin;
}

int PololuMSC::restart() {
// reset the pololu
digitalWrite(this->reset_pin, HIGH);
delay(this->RESET_HIGH_WAIT);
digitalWrite(this->reset_pin, LOW);
delay(this->RESET_LOW_WAIT);

// send initialization byte
this->serialCom->write(0xFF);

return 0;
}
26 changes: 24 additions & 2 deletions PololuServo/pololu_servo.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -16,11 +16,33 @@
* Copyright (C) Stephen Cripps, 2013 * Copyright (C) Stephen Cripps, 2013
*/ */


/* Pololu Micro Servo controller class
*
* Basically the servo controller only needs to have serial commands sent
* to it, in accord with the mode of operation you choose. In this case,
* the library is using the MiniServo commands as opposed to the Pololu
* specific commands, which you can read about in the documentation
* posted on the wiki
*/

#ifndef pololu_servo_h
#define pololu_servo_h

#include <Arduino.h> #include <Arduino.h>


class PololuMSC { class PololuMSC {
private: private:
static const int RESET_HIGH_WAIT = 100;
static const int RESET_LOW_WAIT = 1000;

Stream* serialCom; Stream* serialCom;
int reset_pin;
public: public:
PololuMSC(Stream*); /** One instance of an initialised serial port and the pin for
} * the reset on the Pololu
*/
PololuMSC(Stream*, int);
int restart();
};

#endif

0 comments on commit 3b90636

Please sign in to comment.