I want to interfacing attiny45 with ws2812. I use neopixel to control the ws2812. It didn't work, but it works when I tried my code with Arduino. How to fix this?
Sorry for not providing a solution, but perhaps I can help to get a step further (or backwards).
The ATtiny is not officially supported by Arduino and the ATtiny85 is the most used.
First of all, there is a "core" or "build environment" to select, for example one of these:
You can copy-paste your own sketch in it, and it will stay dark. If you want to make your own Wokwi project and store it, then you have to log in (it's free).
As far as i know adafruit_neopixel actually is supposed to support AVR's as well. The first thing is to tell us which core you are using, and have you set the clock speed by doing 'burn bootloader' to set the fuses ?
I have never used a ATtiny45, but i think i've managed to get it working on an 85, which means it should work on a 45 just as well. In fact i've found the sketch and it looks very similar to yours (albeit a bit more elaborate) and i've found the project which is battery powered.
I use SpenceKonde's ATtiny core 1.5.2 (for as long as it takes before the update to 2.0 is ready)
Just include
#ifdef __AVR__
#include <avr/power.h>
#endif
and make sure you do 'burn bootlaoder at 8MHz internal, and let me know.
I'm running the simulation using Proteus. Now it works by setting the CKSEL Fuses to PLL CLOCK. I don't know it would or wouldn't works if I burn my code to the ATtiny.
Yeah 'burn bootloader' still i have mine working on 8MHz internal as well, which means you can run it also at lower voltages. adafruit_neopixel checks for CPU speed and compiles accordingly.