Hey, I don't know if this is the right place, but my issue is taking an output from a software SPI and using it in another function for temperature. The code below is marked with my issue, however it's not the full code. The full code is for a lab assignment to display temperature and a clock on an LCD, and the clock is another problem on its own. Thanks in advance for any help.

unsigned int SW_SPI(unsigned int Output)
  bitClear(PORTC, CS_Bit);
  for (int i = 15; i >= 0; i--)
    bitSet(PORTB, SClk_Bit); 
   if ( PINB & 0x01){
    bitWrite ( Output, i, 1);
   else {
    bitWrite ( Output, i, 0);
    bitClear(PORTB, SClk_Bit); 
  bitSet(PORTC, CS_Bit); 
  return Output;

float ReadTemperature()
  digitalWrite (A2, LOW); // A2 is the pin of CS_Bit
 int TempBits = SW_SPI;         /*The error code is here: invalid conversion from 'int (*)(int)' to 'int' [-fpermissive]*/
 digitalWrite (A2, HIGH);
 float Temperature = 0.25 * (float)TempBits;
 Temperature = 1.8*Temperature + 32.0;
  return Temperature;

The first thing that catches my eye, is that you're calling a function (SW_SPI) without passing it the argument it needs(unsigned int Output).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.