// ATtiny85 Blink!
#define LED_PIN PB0
// Low Primer alarm
#include "Multi_Timer_V2.h"
const byte primer_PRX = PB3;
const byte ramDown_PRX = PB4;
const byte alarmLED = PB0;
const byte ramDownLED = PB1;
bool primersPresent;
bool ramIsDown;
bool alarmIsSet;
OnDelayTimer ramInDownPositionTimer(1000); //
FlasherTimer alarmLEDFlasher(2000, 500);
void setup() {
pinMode(primer_PRX, INPUT_PULLUP);
pinMode(ramDown_PRX, INPUT_PULLUP);
pinMode(alarmLED, OUTPUT);
pinMode(ramDownLED, OUTPUT);
}
void loop() {
Multi_Timer::updateAllTimers();
primersPresent = (digitalRead(primer_PRX) ? true : false);
ramIsDown = (digitalRead(ramDown_PRX) ? false : true);
digitalWrite(ramDownLED,ramIsDown);
// test for primers when ram is at bottom of stroke
// for one second, set/reset alarm accordingly.
ramInDownPositionTimer.setEnable(ramIsDown);
if (ramInDownPositionTimer.getDoneRose()){
alarmIsSet = !primersPresent;
}
alarmLEDFlasher.setEnable(alarmIsSet);
digitalWrite(alarmLED, alarmLEDFlasher.isFlashing() ? HIGH : LOW);
}
primer PRX
ram down PRX