ATTINY85 software serial to send HEX

Hi

I am trying to write a bit of code that just sends a single HEX code in a loop whenever the ATTINY85 is powered up.

When I try and compile the code it says the following

ecuSerial.write(H_code());

expression cannot be used as a function

Can someone help correct whatever I have done wrong.

[code]
//Send HEX code 0x5E in a constant loop when ATTINY85 is powered

// These set the ECU SoftwareSerial RX and TX pins, and bit rate
#define RX_PIN              4
#define TX_PIN              3
#define BIT_RATE            100

#define H_code           0x5E


#include <SoftwareSerial.h>


SoftwareSerial ecuSerial(RX_PIN, TX_PIN); // RX, TX, standard polarity logic


void setup()

{
  ecuSerial.begin(BIT_RATE);

  // pinMode(CONTROL_PIN, INPUT_PULLUP);

}

void loop()

{
  ecuSerial.write(H_code());
  delay(100);
}

[/code]

Thank You

How did you define "H_code"? Is it a function? Can you use it as a function?

hi christop

At the top of the code i put

#define H_code 0x5E

dont know whether i should remove that and just put the hex in to read

ecuSerial.write(0x5E);

Well, consider this: a "#define" macro is essentially like a text find-and-replace feature. So this code:

#define H_code           0x5E
  ecuSerial.write(H_code());

is replaced by:

  ecuSerial.write(0x5E());

and the compiler is complaining that 0x5E can't be used as a function (because 0x5E isn't a function).

What would you change in the second code snippet to make it not a function? Do the same in your code.

I've now removed the () after the 0x5E and it compiled. Will now test and see if it works

Update:

Still not working