Arduino > WheelWatcher

Contents (hide)

  1. 1. WW-12
    1. 1.1 Sign/Magnitude Mode

1.  WW-12

http://www.nubotics.com/products/ww12/index.html

1.1  Sign/Magnitude Mode

Code Msg

#include <msg.h>

byte count;
byte data[2];

void message() {

}



void setup() {

        msg.setup(message,"Wheel Watcher"); // Setup msg

        msg.detach(2);
        msg.detach(3);

        // Interrupt 0 is linked to pin 2
        attachInterrupt(0, blip, CHANGE);

}

void loop() {

        msg.loop(); // Update msg

        if ( count > 0 ) {

                data[0] = digitalRead(3);
                data[1] = count;
                msg.writeBytes(data,2);
                count = 0;
        }

}

void blip() {

        count++;

}