Skip to content

dummy variable mandatory for code to start #3

Description

@ch-nry

hello,

thanks a lot for your code.
It will be very usefull for my current project.
The example is working perfectlly (after changing makefile to use attiny45 and setting fuses).
(i'm using linux, and avrdude as programer)

However, i noticed somthing that i can't understand :

this function is working :
int main()
{
Servo8Bit myServo; //create a servo object.
myServo.attach(1); //attach the servo to pin PB1
int nothing = 0;
while(1)
{
myServo.write(85); //rotate
delay(1000); //wait
myServo.write(95);
delay(1000);
}
}

but this function is not working :

int main()
{
Servo8Bit myServo; //create a servo object.
myServo.attach(1); //attach the servo to pin PB1
// int nothing = 0;
while(1)
{
myServo.write(85); //rotate
delay(1000); //wait
myServo.write(95);
delay(1000);
}
}

a dummy variable has to be declare, otherwise the code won't start.
Do you have a logic explanation?

best

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions