EDIT: Alright I'm stupid, I had the 2012 library installed somehow, maybe when I downloaded it indirectly from another old tutorial site. Thanks a ton to Peter Freerick for pointing that out! It finally compiled now
So I'm currently doing a little project where I have an ATTiny85 controlling some (neopixel) RGB addressable LEDs, which is controlled over i2c from an Arduino UNO Master. The goal is to make an Attiny85 into an i2c slave that receives a simple command (such as a single digit int) and decide which premade LED display program to use.
I'm using ATTinyCore, TinyWireS, and Adafruit's tinyNeopixel library for the tiny, and programming it using an Arduino UNO as ISP.
My issue is this: The led code requires a delay to change the speed of the light show. But I see in the TinyWireS example here that I should be using tws_delay instead of the normal delay.
Various googling attempts have left me nowhere to learn how to use tws_delay, what it is, or how to even declare it. I get a declaration error when I try to use the delay with the TinyWireS library included.
I would like to find a resource for learning how to declare and use this delay. Thank you for reading this far
EDIT: I have now added my code and error below, you can find the tws_delay in void loop near the bottom
// NeoPixel Ring simple sketch (c) 2013 Shae Erisson
// released under the GPLv3 license to match the rest of the AdaFruit NeoPixel library
#if (F_CPU>7370000) //neopixel library required 7.37MHz minimum clock speed; this line is used to skip this sketch in internal testing. It is not needed in your sketches.
#include <tinyNeoPixel.h>
#include <TinyWireS.h>
// Which pin on the Arduino is connected to the NeoPixels?
#define PIN 3
// How many NeoPixels are attached to the Arduino?
#define NUMPIXELS 8
// When we setup the NeoPixel library, we tell it how many pixels, and which pin to use to send signals.
// Note that for older NeoPixel strips you might need to change the third parameter--see the strandtest
// example for more information on possible values.
tinyNeoPixel pixels = tinyNeoPixel(NUMPIXELS, PIN, NEO_RGB + NEO_KHZ800);
int delayval = 500; // delay for half a second
void setup() {
pixels.begin(); // This initializes the NeoPixel library.
}
void loop() {
// For a set of NeoPixels the first NeoPixel is 0, second is 1, all the way up to the count of pixels minus one.
for(int i=0;i<NUMPIXELS;i++){
// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
pixels.setPixelColor(i, pixels.Color(0,150,0)); // Moderately bright green color.
pixels.show(); // This sends the updated pixel color to the hardware.
tws_delay(delayval); // Delay for a period of time (in milliseconds).
}
}
#else //neopixel library required 7.37MHz minimum clock speed; these and following lines are used to skip this sketch in internal testing. It is not needed in your sketches.
#warning "Neopixel control requires F_CPU > 7.37MHz"
void setup() {}
void loop() {}
#endif
And the error:
C:\Users\Dean\AppData\Local\Temp\arduino_modified_sketch_145294\simple.ino: In function 'void loop()':
simple:36:5: error: 'tws_delay' was not declared in this scope
tws_delay(delayval); // Delay for a period of time (in milliseconds).
^~~~~~~~~
C:\Users\Dean\AppData\Local\Temp\arduino_modified_sketch_145294\simple.ino:36:5: note: suggested alternative: 'delay'
tws_delay(delayval); // Delay for a period of time (in milliseconds).
^~~~~~~~~
delay
Multiple libraries were found for "tinyNeoPixel.h"
Used: C:\Users\Dean\AppData\Local\Arduino15\packages\ATTinyCore\hardware\avr\1.3.2\libraries\tinyNeoPixel
Multiple libraries were found for "TinyWireS.h"
Used: C:\Users\Dean\Documents\Arduino\libraries\TinyWireS
exit status 1
'tws_delay' was not declared in this scope
tws_delay()
function, just as it is used in this example from the library