I'm a beginner and working on input capture for a comparator when AIN1 is greater than AIN0 (a constant voltage). Please, I need help in writing such codes.
Hi,
I guess beginnin to read the tutorials on how to program the arduino come in handy.
Check http://arduino.cc/en/Reference/AnalogRead to learn on how to work with analog values.
Read about analogReferance() because this can be what you are looking for.
What you need to do is, setup the arduino with the reference voltage and the input voltage and see if you can change the state of let's say a led.
Maybe something like this:
if vRef > vIn then led off
if vRef == vIn then led blink
if vRef < vIn then led on
This makes a nice programming exercise.
You can use a potentiometer to change the vIn.
Are you wanting to use the chip's built in comparator?
I think its trivial, but am a beginner. I'll be using a potentiometer for the vIn, and I want to be able to view the output on an oscilloscope when vIn is greater than vRef.
I'm using Arduino Mega. Searching this whole forum, I found the code for the analog comparator http://arduino.cc/forum/index.php/topic,71865.0.html
But now, after making the comparations, I want to be able to view the pulses on the oscilloscope when vIn starts getting larger than vRef
I want to be able to view the pulses on the oscilloscope
Sorry still not too clear, when you say this, what exactly do you want to view? Do you want to output a trigger pulse for the oscilloscope from the arduino? I assume one of the voltages is changing rapidly.
Basically it boils down to what you want the arduino to do when the comparator is triggered.
Yes, I want it to trigger an output to the oscilloscope. And also, how do make the connections to the oscilloscope?
And also, how do make the connections to the oscilloscope?
Most people use wire. Some glue it on. Some solder the connections. Some wire-wrap the connections. Some use spring clips.
And also, how do make the connections to the oscilloscope?
Use the scope's external trigger if it has one, otherwise use another channel. If you have a single channel scope with no external trigger then you are screwed.