Need to get a signal from led but only when constantly on
i have piece of equipment illuminates led when on, want use led being on input arduino way can pickup signal equipment.
but have problem:
when equipment in normal operation led illuminated if fault develops led flashes on/off every 500ms.
i not want arduino if led flashing
only when led on steadily should arduino run.
i new coding don't know start appreciated
but have problem:
when equipment in normal operation led illuminated if fault develops led flashes on/off every 500ms.
i not want arduino if led flashing
only when led on steadily should arduino run.
i new coding don't know start appreciated
so, if led illuminated period of, 1 second, enough you. try (untested)
code: [select]
unsigned long leddetectedms = 0;
int ledpin = 5 ; // choice
boolean lastledstatus = low ;
setup() {
pinmode( ledpin , input ) ;
}
loop() {
if ( ledpin == high && lastledstatus == low) {
leddetectedms = millis() ;
}
else if ( ledpin == low ) {
leddetectedms = 0 ;
}
if ( ledpin == high && millis() - leddetectedms > 1000ul && leddetectedms != 0 ) {
// equipment on
}
else {
// equipment off
}
lastledstatus = ledpin ;
}
Arduino Forum > Using Arduino > Project Guidance > Need to get a signal from led but only when constantly on
arduino
Comments
Post a Comment