my name is chris and i´m working on a temperature regulation.
the regulation works fine. the spi communication also works.
i want to send the value calculated by the regulation to an extern dac via SPI.
when i calculated the value i return it and handle it to the dac transmitter function, but nothing happens.
do the calculations somehow block the transfer?
here my code:
void MyClass::loop()
{
float z = adc.adcNtc(); // function reads adc value and calculates temperature
int t = (int(z))*10; // integer necessary for regulation
int reg = regelung.Ntc(t); // calculate regulation value (works for itself)
dac.setDac(reg,3); // function sends regulationvalue to dac (works for itself)
}
i can send values to the dac but when i add the calculations it does not work anymore.
I'm not sure where it stops and which dac library you use.
Could you add Serial.println() messages to print the variables like "z", "t" and "reg" to the serial monitor.
Is this Java ? int t = (int(z))*10;
In the 'c' or 'c++' language you can cast it to an integer : int t = (int) z * 10;
Hi!
The DAC.h is a selfwritten class.i use atmel studio.
I've written all the values to the display.every variable contains a correct value.
reg is an integer value(value~100-500) .