DAC project questions

Because you explained it so poorly. Reply #3 would do what you want.

1 Like

All the posts will be very helpful once I do a lot more studying on all the methods mentioned. Just very green right now. Got what I needed for sure!

Ok, great! Keep at it, it will stick.

Yea, post#3 was the first solution presented.

There are a lot of ways of doing it, almost as many ways as there are programmers...

Hi,

Thanks for the clarification..
9hours on the forum can mean, as you can see 26 posts, some even more responses.

Tom....

Why look at a sometimes flickering binary representation of an analog value? That's like an old movie from the 1960:ies, showing computers with blinking, magic(?)lights.
Think about a one bit flickering between hex 0x2ff and 0x300? All LEDs dancing. A more usual digital presentation would show a lot more clear and easy reading.

The answer was given right in reply #2. Had you investigated that, few of the following replies would have been necessary.

I simply didn't feel the need to repeat what had already been said.

It’s not so much about seeing the LEDs light up for me. I want to learn more about AD and DA conversion. I want to be able to read an analog value, convert it to digital, then to a binary set, then execute the binary instructions to get an analog output on the other side. The LEDs are just the first representation I thought about.

Basically, I’ve got the AD part down (simply use analogRead(A0); then print the returned value.) After that, I’m at a dead end. But still have to look at the aforementioned methods in this thread and try to learn them.

A digital value is a binary set

Also, does your board have a D/A converter on it? Are you still interested in lighting LEDs or no?

I know they’re synonymous terms. I just mean that the ADC returns binary values in real numbers instead of binary numbers (1023 instead of 1111111111)

And yes! Still interested in lighting up LEDs. I don’t believe my arduino has a DAC onboard. But I’m familiar with R2R DACs.

I work nights so haven’t had time yet to revisit the project with the answers I’ve been given thus far!

Whatever makes you think that?

Its output is most certainly in binary (which is a very "real" number).

The only way you will ever see "1023" is if some code converts it to that notation for you.

Perhaps I’m missing some other step, but the serial monitor in the Arduino IDE is showing values from 0 to 1023. Seeing it with my own eyes makes me think that.

And I don't suppose you just happened to use a piece of rather complex library code called, say, "Serialprintln()" which magically converts binary values (and floating point values, and also displays character codes) into your familiar decimal notation?

I think that was what gave me doubts my solution in reply #2 was the appropriate one.

(Wow! This got big overnight!)

I've been having second thoughts about the ice cream. Even I would be leery of accepting it from anyone that is also offering me a decomposing rodent.

Binary, octal, decimal, hexadecimal are different representations that can be used for any value. As already told, bit are the representation inside the electronics and the code. Possible values are 0 resp. 1. Stacking bits, 8, 16, 32, 64 bits makes the variable handle larger values.

Have a look:

``````digitalWrite(led1Pin, value & 1 )
digitalWrite(led2Pin, (value & 2 ) >>1)
digitalWrite(led3Pin, (value & 4 )>>2)
digitalWrite(led4Pin, (value & 8 )>>3)
etc.
``````

10 lines of code.