Hi there. I am trying to create a circuit using an attiny84 which sleeps until a button is pressed and then it animates an addressable led. I have managed to get the tiny to sleep and ive managed to get it to animate the led but i have only been able to use physical pin 5, (arduino pin 8) to get either of them to work which leaves me in a predicament. i have plenty of pins left as you can see so its frustrating that i have only had success using this pin to do either of the tasks. is there any way i could either wake the tiny or animate the led with another pin? ive included a schematic for reference.
i have been using this library to put the tiny to sleep.
i have been using the neopixel library to animate the led.
here is the sleep code:
/** This example shows you how to wake from an external interrupt rather than waiting for a given length of time.
*
* Connect a button betwen the interrupt pin and ground, press said button to trigger an interrupt and wake.
*
*/
#include <SimpleSleep.h>
SimpleSleep Sleep;
const uint8_t ledPin = 5;
const uint8_t interruptPin = 8;
void setup()
{
pinMode(ledPin, OUTPUT);
pinMode(interruptPin, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(interruptPin), interruptHandler, LOW);
}
void interruptHandler()
{
// In this example, do nothing we will just wakeup and continue from where-ever
// we went to sleep, of course maybe you might want to do something else on
// the interrupt also, up to you.
}
void loop()
{
// Blink once then sleep until an external interrupt happens
digitalWrite(ledPin, HIGH);
delay(500);
digitalWrite(ledPin, LOW);
delay(500);
digitalWrite(ledPin, HIGH);
delay(500);
digitalWrite(ledPin, LOW);
Sleep.deeply();
}
here is the led code:
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h> // Required for 16 MHz Adafruit Trinket
#endif
#define LED_PIN 8
// How many NeoPixels are attached to the Arduino?
#define LED_COUNT 6
// Declare our NeoPixel strip object:
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
// setup() function -- runs once at startup --------------------------------
void setup() {
strip.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
strip.show(); // Turn OFF all pixels ASAP
strip.setBrightness(50); // Set BRIGHTNESS to about 1/5 (max = 255)
}
// loop() function -- runs repeatedly as long as board is on ---------------
void loop() {
// Fill along the length of the strip in various colors...
colorWipe(strip.Color(255, 0, 0), 50); // Red
colorWipe(strip.Color( 0, 255, 0), 50); // Green
colorWipe(strip.Color( 0, 0, 255), 50); // Blue
// Do a theater marquee effect in various colors...
theaterChase(strip.Color(127, 127, 127), 50); // White, half brightness
theaterChase(strip.Color(127, 0, 0), 50); // Red, half brightness
theaterChase(strip.Color( 0, 0, 127), 50); // Blue, half brightness
rainbow(10); // Flowing rainbow cycle along the whole strip
theaterChaseRainbow(50); // Rainbow-enhanced theaterChase variant
}