Go Down

Topic: Code not working in my sketch??? (Read 664 times) previous topic - next topic


I have spent countless hours trying to solve this error myself.
I am a new user though, so there is probably a very easy way to fix this issue.

I have tried to add the libraries for this code;

#include <avr/io.h>
#include <avr/sleep.h>
#include <avr/wdt.h>
#include <stdlib.h>
#include <util/atomic.h>
#include <util/delay.h>

I am not sure if I added these libraries correctly or not after downloading them.

Here is the website that I copied the code from on GitHub;

I think the problem is that he is not compiling the code on an Arduino IDE.
I`m not sure though.

The code is for a timed beeper.

I keep getting the error message;
'PWM1B' was not declared in this scope

I have already downloaded and added a library called 'SoftPWM.h'  although im not sure if that is diffrent from 'PWM.h' or not.

Could someone please help me with this issue?

I`m sorry if I have not added enough information or posted this incorrectly.
This is actually my first post. If I am not using this forum correctly, please let me know.

Thank you


Which board do you have selected from the Tools > Board menu? This code contains processor-specific code. It is the opposite of the typical high level, extremely portable Arduino code. It is only compatible with a small set of microcontrollers. I know it will compile for ATtiny85/45/25. I don't know which others.


Thank you so much.

Although, now I am having trouble installing the ATtiny board package to my IDE.
I am running IDE version 1.8.9

I only have the option to choose Arduino AVR boards.
When I go to the boards manager and type in attiny in the search bar, nothing shows up.

Do I need to connect the ATtiny85 in order for it to be recognized in the IDE?


Ok, now I got it!

The code is up and running.

Once again, thank you so much for your help!
I REALLY appreciate it!


You're welcome. I'm glad if I was able to be of assistance. Great job on getting it working. Enjoy!

Go Up