Bill Of Materials
The Spool Of Wire
http://www.amazon.com/gp/product/B0082CUR1K/ref=oh_details_o00_s00_i00?ie=UTF8&psc=1
Spool Holder
http://www.thingiverse.com/thing:219530
So the adventure starts with this Arduino setup
int hallsensor = 9;
const int ledPin = 6;
const int ledPinWarn = 7;
const int ledPinStop = 8;
const int resetIn = 2;
const int resetOut = 3;
int wrapcount = 0;
int count1=0;
void setup()
{
pinMode(hallsensor, INPUT);
pinMode(resetIn, INPUT);
pinMode(resetOut, OUTPUT);
pinMode(ledPin, OUTPUT);
pinMode(ledPinWarn, OUTPUT);
pinMode(ledPinStop, OUTPUT);
Serial.begin(9600);
digitalWrite(resetOut, LOW);
}
void loop()
{
int hall = digitalRead(hallsensor);
int reset = digitalRead(resetIn);
if (hall == 0) {
if (count1 < 1){
for (int i=0; i < 1; i++){
// digitalWrite(ledPin, HIGH);
PORTD |= 0b01000000;
wrapcount++;
count1=1;
}
}
}
else {
//digitalWrite(ledPin,LOW);
PORTD &=~_BV(ledPin);
count1 = 0;
}
if (wrapcount > 390 ){
digitalWrite(ledPinWarn, HIGH);
if (wrapcount > 300 ){
digitalWrite(ledPinWarn, LOW);
digitalWrite(ledPinStop, HIGH);
}
}
if (reset == 1){
digitalWrite(ledPinWarn, LOW);
digitalWrite(ledPinStop, LOW);
wrapcount = 0;
}
Serial.println(wrapcount);
}