#define DATA 8
#define LATCH A3
#define CLOCK 12
#define LATCH_ON PORTC = PORTC | B00001000
#define LATCH_OFF PORTC = PORTC & B11110111
#define CLOCK_ON PORTB = PORTB | B00010000
#define CLOCK_OFF PORTB = PORTB & B11101111
#define DATA_ON PORTB = PORTB | B00000001
#define DATA_OFF PORTB = PORTB & B11111110
const long interval = 1000;
unsigned long previousMillis = 0;
void shiftByteMSF(byte HB){
int isblinking = 0;
unsigned long blinkstate=0;
int lasttimechanged=0;
int delaytime = 500;
void setup(){
DDRC|=LATCH_ON;
DDRB|=DATA_ON;
DDRB|=CLOCK_ON;
}
void loop(){
const long interval = 1000;
unsigned long previousMillis = 0;
void shiftByteMSF(byte HB){
int isblinking = 0;
unsigned long blinkstate=0;
int lasttimechanged=0;
int delaytime = 500;
LATCH_OFF; //sets latch low before data sending
for(int BitShift=0; BitShift<8; BitShift++) { //repeat 8 times, incrementing .
if(bitRead(HB, 7-BitShift) == 1) { //read the bit for HB, and begins from right most bit
DATA_ON;
}
else{
DATA_OFF;
}
CLOCK_ON; //cycle clock once data value stable
CLOCK_OFF;
DATA_OFF; //0 on data, if it was already high, after clock pulse
}
LATCH_ON; //turns latch on to transfer the data to the register
}
byte HB_ON = B10000000;
byte HB_OFF = B00000000;
if(HB_ON==0){
HB_OFF==1;
}else (HB_OFF==0){
HB_ON==1;
}
}
so im getting the following error:
void setup(){
^
heartbeatstate:25:12: error: a function-definition is not allowed here before '{' token
void loop(){
^
heartbeatstate:60:1: error: expected '}' at end of input
}
^
exit status 1
a function-definition is not allowed here before '{' token
anyone how to fix this error?