uhhh... thanks i guess???Normally, you purchase books, or better yet, go online to Google, and search for beginner arduino code writing and learn how to program. Learning electronics on top of programming is a whole 'nother field. Good luck!
Basically just a square wave. for example OFF, then ON for couple of ms, and then OFF again. Inorder to covnert it into a sinus pulse i would just use an RC filter at the outputDraw a pic of the signal you would like to generate.
Regards, Dana.
Its impossible to get an analogRead for the signal while the delay takes placeThe simple way to do it is:
Digitalwrite(high)
Delay(x)
Digitalwrire(low)
That is correct.Its impossible to get an analogRead for the signal while the delay takes place
Are you trying to generate a sine burst ? Not sure I understand.Basically just a square wave. for example OFF, then ON for couple of ms, and then OFF again. Inorder to covnert it into a sinus pulse i would just use an RC filter at the output
Start a second counter on button press and set a signal high.(eq flag > Start_Count= 1; the counter TimeCount++; EndCount=xxHi All,
How do i write an arduino code, so that i maybe able to digitalwrite for 'x' number of seconds from a single press of a button
int OutPortPin = 2;
unsigned long startTime;
unsigned long currentTime;
unsigned long interval = 2000; // milliseconds
void setup() {
pinMode(OutPortPin, OUTPUT);
noTone(OutPortPin);
}
void loop() {
// 2 sec burst of a 1000 Hz square wave
interval=2000;
startTime = millis(); //get the current millisecond count
while ( (currentTime=millis())-startTime<=interval)
{
// 1000 Hz
digitalWrite(OutPortPin, HIGH);
delayMicroseconds(500);
digitalWrite(OutPortPin, LOW);
delayMicroseconds(500);
}
delay (2000); // delay to seperate the two methods
// 2 sec burst of a 1000 Hz square wave
// 1000 Hz
tone(OutPortPin,1000,interval);
here: goto here; // just do this once
}