I working on a metal detector. I need to digital out put for 160 microseconds. I want the frequency to be 100 khz . I can not find anything but microseconds. I want to use the arduino for the osc. and other functions. But I am not good a programing. If I could get an example of something that functions at that freq or close and time in microseconds. I might beable to figure the rest out.
Pinout 167 microseconds pulse at 100 hz ? can the Arduino do this? I want to build a metal detector and require 167 micosecond pulse at 100 hz. I can pulse it for 1 milsecond but can't find where to pulse for a much shorter time period. Also how do you set up 100 hz repeat rate.
Any assistance would be appreciated . I can do this with hardware but want to try with software if possible.
// define varialbles, declare outputs used, etc. Then:
void loop()
{
// check if time needs updating
unsigned long currentMicros = micros(); // see how long its been
if (currentMicros - previousMicros >= 10000) // 10mS, 100 Hz rate
{
// set up time for next update
previousMicros = previousMicros + 10000 ;
digitalWrite (pulseBit, HIGH);
delayMicroseconds(165); // tweak a little if scope shows this is off
digitalWrite (pulseBit, LOW);
} // end if 10mS
} // end loop