Generating a single pulse without using delay and resources


hello,

for railroad project drive electro magnet. how can generate single pulse (-+ 200 - 250 ms)?
now use function reads values each time check takes of resources of arduino mega think.
delay,... isn't available in case.
i found topics wasn't thing.



regards,
minitreintje

code: [select]

void loop() {
  static unsigned long pulsetimer.
  if (timetodoapulse && !doingapulse) {
    doingapulse = true;
    pulsetimer = millis();
    digitalwrite(solenoidpin, high);
  }

  if (doingapulse && millis() - pulsetimer >= 225) {
    digitalwrite(solenoidpin, low);
    doingapulse=false;
  }
}

     


Arduino Forum > Using Arduino > Programming Questions > Generating a single pulse without using delay and resources


arduino

Comments

Popular posts from this blog

Convierte tu Raspberry en un NAS. Firmware fvdw-sl 15.3 - Raspberry Pi Forums

How to format a Get Request

avrdude: verification error, first mismatch at byte 0x0000 0x0c != 0x62