Griiker
November 14, 2018, 4:06am
1
Hi everyone!
I'm getting a "expected primary-expression before 'float'" message,
What does it mean by "primary expression?" The line in question is calling a function in a header file, which gives me a feeling of uncertainty and cloudy incomprehension.
any ideas?
void loop()
{
metervoltage = analogRead(meterpin);
doublemetervoltage = 2 * metervoltage;
digitalcoeff = (5 / 1023);
flowrate = 0.00488759 * doublemetervoltage; // 0.00488759=digitalcoeff;
dac_voltage = flowrate;
LTC2664_voltage_to_code(dac_voltage, float min_output, float max_output);
LTC2664_write(LTC2664_CS, LTC2664_CMD_WRITE_ALL_UPDATE_ALL, 0, dac_voltage);
Remove the float from
LTC2664_voltage_to_code(dac_voltage, float min_output, float max_output);
If you need to cast because the function expects floats, put braces around the float
LTC2664_voltage_to_code(dac_voltage, (float)min_output, (float)max_output);
If you get compiler warnings or errors after that, post your complete code. We have no idea what the types of the variables are or what your functions expect as parameters.
Griiker
November 14, 2018, 4:19am
3
I'm trying to call a function in a header file using this line:
LTC2664_voltage_to_code(dac_voltage, float min_output, float max_output);
and I have no idea what a "primary-expression" is, or what it is reffering to. any ideas?
Thanks,
Justin
void loop()
{
metervoltage = analogRead(meterpin);
doublemetervoltage = 2 * metervoltage;
digitalcoeff = (5 / 1023);
flowrate = 0.00488759 * doublemetervoltage; // 0.00488759=digitalcoeff;
dac_voltage = flowrate;
LTC2664_voltage_to_code(dac_voltage, float min_output, float max_output);
LTC2664_write(LTC2664_CS, LTC2664_CMD_WRITE_ALL_UPDATE_ALL, 0, dac_voltage);
expected primary-expression before 'float'
If you're trying to cast min_output and max_output as floats, it needs to read as (float) min_output ...
Griiker
November 16, 2018, 3:06pm
6
Thanks everyone, for the help. Still learning stuff.
This is for a DAC, and it gets complicated very fast.