Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Wrote the beginnings of the pololu msc lib

  • Loading branch information...
commit 3b90636c71c0acae88f21ba4af7601fe000688a5 1 parent 240f5c1
@allgood38 allgood38 authored
Showing with 43 additions and 2 deletions.
  1. +19 −0 PololuServo/pololu_servo.cpp
  2. +24 −2 PololuServo/pololu_servo.h
View
19 PololuServo/pololu_servo.cpp
@@ -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;
+}
View
26 PololuServo/pololu_servo.h
@@ -16,11 +16,33 @@
* 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>
class PololuMSC {
private:
+ static const int RESET_HIGH_WAIT = 100;
+ static const int RESET_LOW_WAIT = 1000;
+
Stream* serialCom;
+ int reset_pin;
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
Please sign in to comment.
Something went wrong with that request. Please try again.