Mcp4725+mcp9808

Zastanawiam się jak stworzyć program na współgrające ze sobą czujniki temperatury i czujnik DAC
Chodzi o linijki kodu jak napisać by przy zwiększaniu temperatury zwiększało się jednocześnie napięcie.
Zakres napięcia = 0-5V
Zakres temperatury = 0-80stopniC
40 stopni to 2,5V
Używam gotowych bibliotek dołączonych do tych czujników.

This is the English section of forum.

Czy udało Ci się napisać osobne programy, które pokazują, że możesz odczytać czujnik i uzyskać wyjście z DAC-a?

Istnieją proste przykłady, uruchom to, aby sprawdzić okablowanie.

Logika wydaje się banalna, spowoduje to, że czujnik i DAC będą działały razem.

If you continue here, please have the courtesy to use google translate so every one of us doesn't have to. Use google translate.

HTH

a7

I only found how to setVoltage with some formula found on datasheet but idk how to set this to be corresponding temperatures

You have to start earlier.

Get the DAC to work. Use example code.

Get the sensor to work. Again, you should be able to find example code easily, either in the IDE or the library documentation or google.

a7

I'm using (on the DAC) setVoltage(value, bool)
dac.setVoltage(1224.704, false) (this is around 23 degrees)
temp = tempsensor.readTempC(); and this for temperature sensor
Idk just how to put them together to get rising dac value and rising temp value

No one can say for you what the relationship between temperature input and voltage output should be, but you may find

map
fmap
constrain

make some of the algebra easier.

If you google

Arduino map

,

Arduino fmap

and

Arduino constrain

You can see some details on those functions.

HTH

a7