So basically i want to use pwm on a shift register (74HC595) and because i dont have much room to play with i want to use the attiny85 as the microcontroller
I took "inspiration" from these two codes and fused it together
PWM through a 74hc595 shift register
Realistic LED Flickering Flame Effect using an Arduino (description)
//https://www.youtube.com/watch?v=OxSUIeZs2d8
This is the code for the arduino that worked flawless:
/**************************************************************
* Name : PWM Control of Shift Registers
* By : Joseph Francis
*
* Open Source
*
* Date : 20 Nov, 2009
* Version : 1.0
* Notes : Code for using a 74HC595 Shift Register PWM
****************************************************************/
#include <TimerOne.h>
//-- Update the TICKER_MAX and _STEP to 16 16 or 32 8 or 64 4 for performance vs colors available
#define TICKER_MAX 64
#define TICKER_STEP 4
bool signal = false;
bool an = false;
bool trans;
int signalPin = 7;
//Registerpins
int sr1 = 0;
int sr2 = 1;
int sr3 = 2;
int sr4 = 3;
int sr5 = 4;
int sr6 = 5;
int sr7 = 6;
int sr8 = 7;
//Ticker Registerpins
int TICK = 0;
//-- May have to tweak the timer based on number SR's
int timerDelay = 350;
//--- Pin connected to ST_CP of 74HC595
int latchPin = 10;
//--- Pin connected to SH_CP of 74HC595
int clockPin = 13;
//--- Pin connected to DS of 74HC595
int dataPin = 11;
//--- Used for faster latching
int latchPinPORTB = latchPin - 8;
//======================
//number of multiplex - set to zero for no multiplexing in this example
int groundMax = 0;
//number of Shift Registers - set to 1 for this example
int srcount = 1;
//--- ready for 10 SR's
byte srvals[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
int ticker = 0;
int groundAt = 255;
//--- setup for 10 SR's .. no multiplexing ...
// actually should be SR Count * 8 * multiplexing count (1 based) .. this is just an example for easy usage
byte srPins[80] = {
0,
0,
0,
0,
0,
0,
0,
0,
};
void pwmWrite(int port, byte val) {
srPins[port] = val;
}
void iProcess() {
int srtot = 8 * srcount;
ticker++;
if (ticker > TICKER_MAX)
ticker = 0;
int myPos = ticker * TICKER_STEP;
groundAt++;
if (groundAt > groundMax)
groundAt = 0;
int myLev = 0;
for (int iSR = 0; iSR < srcount; iSR++) {
byte currVal = 0;
for (int i = 0; i < 8; i++) {
myLev = 0;
if (srPins[(i + (8 * iSR)) + (groundAt * srtot)] > myPos)
myLev = 1;
bitWrite(currVal, i, myLev);
}
srvals[iSR] = currVal;
}
latchOff();
for (int iSR = srcount - 1; iSR >= 0; iSR--) {
spi_transfer(srvals[iSR]);
}
latchOn();
}
void latchOn() {
bitSet(PORTB, latchPinPORTB);
}
void latchOff() {
bitClear(PORTB, latchPinPORTB);
}
void setupSPI() {
byte clr;
SPCR |= ((1 << SPE) | (1 << MSTR)); // enable SPI as master
//SPCR |= ( (1<<SPR1) | (1<<SPR0) ); // set prescaler bits
SPCR &= ~((1 << SPR1) | (1 << SPR0)); // clear prescaler bits
clr = SPSR; // clear SPI status reg
clr = SPDR; // clear SPI data reg
SPSR |= (1 << SPI2X); // set prescaler bits
//SPSR &= ~(1<<SPI2X); // clear prescaler bits
delay(10);
}
byte spi_transfer(byte data) {
SPDR = data; // Start the transmission
loop_until_bit_is_set(SPSR, SPIF);
return SPDR; // return the received byte, we don't need that
}
void setup() {
randomSeed(analogRead(0));
Serial.begin(9600);
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
// Project 9 - LED Fire Effect
pinMode(signalPin, INPUT);
digitalWrite(latchPin, LOW);
digitalWrite(dataPin, LOW);
digitalWrite(clockPin, LOW);
setupSPI();
Timer1.initialize(timerDelay); // Timer for updating pwm pins
Timer1.attachInterrupt(iProcess);
pwmWrite(sr1,255);
pwmWrite(sr2,255);
pwmWrite(sr3,255);
pwmWrite(sr4,255);
pwmWrite(sr5,255);
pwmWrite(sr6,0);
pwmWrite(sr7,0);
pwmWrite(sr8,0);
}
void allTo(int val, int delayval) {
int srtot = 8 * srcount;
for (int i = 0; i < srtot; i++) {
pwmWrite(i, val);
if (delayval > 0)
delay(delayval);
}
}
void allOff() {
allTo(0, 0);
}
void allOn() {
allTo(255, 0);
}
void loop() {
//check if signal for thruster bootup is there
if (digitalRead(signalPin) == HIGH) {
signal = true; //set boolean (virtual switch)
} else {
signal = false;
}
if (signal == true) { //if signal is there
if (an == false) { //and if it hasnt been boot up before
delay(200);
for (int i = 255; i > 0; i--) { //boot up animation
pwmWrite(sr1, i + 25);
pwmWrite(sr2, i);
pwmWrite(sr4,i+13);
pwmWrite(sr5,i+40);
delay(25);
pwmWrite(sr1, random(i) +10);
pwmWrite(sr2, random(i) +8);
pwmWrite(sr4, random(i) +9);
pwmWrite(sr5, random(i) +10);
delay(random(10));
an = true;
//blink leds 3,3333333%
if (TICK >= 34){
TICK = 0;
pwmWrite(sr6,0);
}
else{
TICK++;
delay(1);
if (TICK == 20){
pwmWrite(sr6,255);
}
if (TICK == 22){
pwmWrite(sr6,0);
}
if (TICK == 32){
pwmWrite(sr6,255);
}
if (TICK == 27){
pwmWrite(sr7,255);
}
if (TICK == 30){
pwmWrite(sr7,0);
}
if (TICK == 30){
pwmWrite(sr8,255);
}
if (TICK == 33){
pwmWrite(sr8,0);
}
}
}
}
pwmWrite(sr1, random(100)+0); //booted up animation
pwmWrite(sr2, random(100)-1);
pwmWrite(sr4, random(100)-3);
pwmWrite(sr5, random(100)-2);
delay(random(30));
//blink leds 6,6666666%
if (TICK >= 68){
TICK = 0;
pwmWrite(sr6,0);
}
else{
TICK++;
delay(1);
if (TICK == 40){
pwmWrite(sr6,255);
}
if (TICK == 44){
pwmWrite(sr6,0);
}
if (TICK == 64){
pwmWrite(sr6,255);
}
if (TICK == 53){
pwmWrite(sr7,255);
}
if (TICK == 60){
pwmWrite(sr7,0);
}
if (TICK == 60){
pwmWrite(sr8,255);
}
if (TICK == 67){
pwmWrite(sr8,0);
}
}
}
if (signal == false) { //if theres no signal
if (an == true) { //and thrusters were booted up before
for (int i = 0; i < 255; i++) { //boot down animation
pwmWrite(sr1, i + 25);
pwmWrite(sr2, i);
delay(25);
pwmWrite(sr1, random(100) + 0);
pwmWrite(sr2, random(100) + 0);
pwmWrite(sr4, random(100) + 0);
pwmWrite(sr5, random(100) + 0);
delay(random(10));
an = false;
//blink leds 3,656126%
if (TICK >= 37){
TICK = 0;
pwmWrite(sr6,0);
}
else{
TICK++;
delay(1);
if (TICK == 22){
pwmWrite(sr6,255);
}
if (TICK == 24){
pwmWrite(sr6,0);
}
if (TICK == 35){
pwmWrite(sr6,255);
}
if (TICK == 29){
pwmWrite(sr7,255);
}
if (TICK == 33){
pwmWrite(sr7,0);
}
if (TICK == 33){
pwmWrite(sr8,255);
}
if (TICK == 36){
pwmWrite(sr8,0);
}
}
}
for (int i=255; i>0; i--){
pwmWrite(sr1,i+1);
pwmWrite(sr2,i);
pwmWrite(sr3,i+2);
pwmWrite(sr4,i+1);
pwmWrite(sr5,i);
delay(5);
//blink leds 16,6666666%
if (TICK >= 170){
TICK = 0;
pwmWrite(sr6,0);
}
else{
TICK++;
delay(1);
if (TICK == 100){
pwmWrite(sr6,255);
}
if (TICK == 110){
pwmWrite(sr6,0);
}
if (TICK == 160){
pwmWrite(sr6,255);
}
if (TICK == 133){
pwmWrite(sr7,255);
}
if (TICK == 150){
pwmWrite(sr7,0);
}
if (TICK == 150){
pwmWrite(sr8,255);
}
if (TICK == 167){
pwmWrite(sr8,0);
}
}
}
pwmWrite(sr1,255);
pwmWrite(sr2,255);
pwmWrite(sr4,255);
pwmWrite(sr5,255);
for (int i=0; i<255; i++){
pwmWrite(sr3,i);
delay(1);
}
} else { //booted down animation
pwmWrite(sr1, 255);
pwmWrite(sr2, 255);
pwmWrite(sr3, 255);
pwmWrite(sr4,255);
pwmWrite(sr5,255);
//blink leds 100%
if (TICK >= 1020){
TICK = 0;
pwmWrite(sr6,0);
}
else{
TICK++;
delay(1);
if (TICK == 600){
pwmWrite(sr6,255);
}
if (TICK == 660){
pwmWrite(sr6,0);
}
if (TICK == 960){
pwmWrite(sr6,255);
}
if (TICK == 800){
pwmWrite(sr7,255);
}
if (TICK == 900){
pwmWrite(sr7,0);
}
if (TICK == 900){
pwmWrite(sr8,255);
}
if (TICK == 1000){
pwmWrite(sr8,0);
}
}
}
}
}
And this is the code for the attiny. I just switched out the pins. Thats the only difference.
/**************************************************************
* Name : PWM Control of Shift Registers
* By : Joseph Francis
*
* Open Source
*
* Date : 20 Nov, 2009
* Version : 1.0
* Notes : Code for using a 74HC595 Shift Register PWM
****************************************************************/
#include <TimerOne.h>
//-- Update the TICKER_MAX and _STEP to 16 16 or 32 8 or 64 4 for performance vs colors available
#define TICKER_MAX 64
#define TICKER_STEP 4
bool signal = false;
bool an = false;
bool trans;
int signalPin = 4; //Physischer Pin 3
//Registerpins
int sr1 = 0;
int sr2 = 1;
int sr3 = 2;
int sr4 = 3;
int sr5 = 4;
int sr6 = 5;
int sr7 = 6;
int sr8 = 7;
//Ticker Registerpins
int TICK = 0;
//-- May have to tweak the timer based on number SR's
int timerDelay = 350;
//--- Pin connected to ST_CP of 74HC595
int latchPin = 0; //Physischer Pin 5
//--- Pin connected to SH_CP of 74HC595
int clockPin = 2; //Physischer Pin 7
//--- Pin connected to DS of 74HC595
int dataPin = 1; //Physischer Pin 6
//--- Used for faster latching
int latchPinPORTB = latchPin - 8;
//======================
//number of multiplex - set to zero for no multiplexing in this example
int groundMax = 0;
//number of Shift Registers - set to 1 for this example
int srcount = 1;
//--- ready for 10 SR's
byte srvals[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
int ticker = 0;
int groundAt = 255;
//--- setup for 10 SR's .. no multiplexing ...
// actually should be SR Count * 8 * multiplexing count (1 based) .. this is just an example for easy usage
byte srPins[80] = {
0,
0,
0,
0,
0,
0,
0,
0,
};
void pwmWrite(int port, byte val) {
srPins[port] = val;
}
void iProcess() {
int srtot = 8 * srcount;
ticker++;
if (ticker > TICKER_MAX)
ticker = 0;
int myPos = ticker * TICKER_STEP;
groundAt++;
if (groundAt > groundMax)
groundAt = 0;
int myLev = 0;
for (int iSR = 0; iSR < srcount; iSR++) {
byte currVal = 0;
for (int i = 0; i < 8; i++) {
myLev = 0;
if (srPins[(i + (8 * iSR)) + (groundAt * srtot)] > myPos)
myLev = 1;
bitWrite(currVal, i, myLev);
}
srvals[iSR] = currVal;
}
latchOff();
for (int iSR = srcount - 1; iSR >= 0; iSR--) {
spi_transfer(srvals[iSR]);
}
latchOn();
}
void latchOn() {
bitSet(PORTB, latchPinPORTB);
}
void latchOff() {
bitClear(PORTB, latchPinPORTB);
}
void setupSPI() {
byte clr;
SPCR |= ((1 << SPE) | (1 << MSTR)); // enable SPI as master
//SPCR |= ( (1<<SPR1) | (1<<SPR0) ); // set prescaler bits
SPCR &= ~((1 << SPR1) | (1 << SPR0)); // clear prescaler bits
clr = SPSR; // clear SPI status reg
clr = SPDR; // clear SPI data reg
SPSR |= (1 << SPI2X); // set prescaler bits
//SPSR &= ~(1<<SPI2X); // clear prescaler bits
delay(10);
}
byte spi_transfer(byte data) {
SPDR = data; // Start the transmission
loop_until_bit_is_set(SPSR, SPIF);
return SPDR; // return the received byte, we don't need that
}
void setup() {
randomSeed(analogRead(0));
Serial.begin(9600);
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
// Project 9 - LED Fire Effect
pinMode(signalPin, INPUT);
digitalWrite(latchPin, LOW);
digitalWrite(dataPin, LOW);
digitalWrite(clockPin, LOW);
setupSPI();
Timer1.initialize(timerDelay); // Timer for updating pwm pins
Timer1.attachInterrupt(iProcess);
pwmWrite(sr1,255);
pwmWrite(sr2,255);
pwmWrite(sr3,255);
pwmWrite(sr4,255);
pwmWrite(sr5,255);
pwmWrite(sr6,0);
pwmWrite(sr7,0);
pwmWrite(sr8,0);
}
void allTo(int val, int delayval) {
int srtot = 8 * srcount;
for (int i = 0; i < srtot; i++) {
pwmWrite(i, val);
if (delayval > 0)
delay(delayval);
}
}
void allOff() {
allTo(0, 0);
}
void allOn() {
allTo(255, 0);
}
void loop() {
//check if signal for thruster bootup is there
if (digitalRead(signalPin) == HIGH) {
signal = true; //set boolean (virtual switch)
} else {
signal = false;
}
if (signal == true) { //if signal is there
if (an == false) { //and if it hasnt been boot up before
delay(200);
for (int i = 255; i > 0; i--) { //boot up animation
pwmWrite(sr1, i + 25);
pwmWrite(sr2, i);
pwmWrite(sr4,i+13);
pwmWrite(sr5,i+40);
delay(25);
pwmWrite(sr1, random(i) +10);
pwmWrite(sr2, random(i) +8);
pwmWrite(sr4, random(i) +9);
pwmWrite(sr5, random(i) +10);
delay(random(10));
an = true;
//blink leds 3,3333333%
if (TICK >= 34){
TICK = 0;
pwmWrite(sr6,0);
}
else{
TICK++;
delay(1);
if (TICK == 20){
pwmWrite(sr6,255);
}
if (TICK == 22){
pwmWrite(sr6,0);
}
if (TICK == 32){
pwmWrite(sr6,255);
}
if (TICK == 27){
pwmWrite(sr7,255);
}
if (TICK == 30){
pwmWrite(sr7,0);
}
if (TICK == 30){
pwmWrite(sr8,255);
}
if (TICK == 33){
pwmWrite(sr8,0);
}
}
}
}
pwmWrite(sr1, random(100)+0); //booted up animation
pwmWrite(sr2, random(100)-1);
pwmWrite(sr4, random(100)-3);
pwmWrite(sr5, random(100)-2);
delay(random(30));
//blink leds 6,6666666%
if (TICK >= 68){
TICK = 0;
pwmWrite(sr6,0);
}
else{
TICK++;
delay(1);
if (TICK == 40){
pwmWrite(sr6,255);
}
if (TICK == 44){
pwmWrite(sr6,0);
}
if (TICK == 64){
pwmWrite(sr6,255);
}
if (TICK == 53){
pwmWrite(sr7,255);
}
if (TICK == 60){
pwmWrite(sr7,0);
}
if (TICK == 60){
pwmWrite(sr8,255);
}
if (TICK == 67){
pwmWrite(sr8,0);
}
}
}
if (signal == false) { //if theres no signal
if (an == true) { //and thrusters were booted up before
for (int i = 0; i < 255; i++) { //boot down animation
pwmWrite(sr1, i + 25);
pwmWrite(sr2, i);
delay(25);
pwmWrite(sr1, random(100) + 0);
pwmWrite(sr2, random(100) + 0);
pwmWrite(sr4, random(100) + 0);
pwmWrite(sr5, random(100) + 0);
delay(random(10));
an = false;
//blink leds 3,656126%
if (TICK >= 37){
TICK = 0;
pwmWrite(sr6,0);
}
else{
TICK++;
delay(1);
if (TICK == 22){
pwmWrite(sr6,255);
}
if (TICK == 24){
pwmWrite(sr6,0);
}
if (TICK == 35){
pwmWrite(sr6,255);
}
if (TICK == 29){
pwmWrite(sr7,255);
}
if (TICK == 33){
pwmWrite(sr7,0);
}
if (TICK == 33){
pwmWrite(sr8,255);
}
if (TICK == 36){
pwmWrite(sr8,0);
}
}
}
for (int i=255; i>0; i--){
pwmWrite(sr1,i+1);
pwmWrite(sr2,i);
pwmWrite(sr3,i+2);
pwmWrite(sr4,i+1);
pwmWrite(sr5,i);
delay(5);
//blink leds 16,6666666%
if (TICK >= 170){
TICK = 0;
pwmWrite(sr6,0);
}
else{
TICK++;
delay(1);
if (TICK == 100){
pwmWrite(sr6,255);
}
if (TICK == 110){
pwmWrite(sr6,0);
}
if (TICK == 160){
pwmWrite(sr6,255);
}
if (TICK == 133){
pwmWrite(sr7,255);
}
if (TICK == 150){
pwmWrite(sr7,0);
}
if (TICK == 150){
pwmWrite(sr8,255);
}
if (TICK == 167){
pwmWrite(sr8,0);
}
}
}
pwmWrite(sr1,255);
pwmWrite(sr2,255);
pwmWrite(sr4,255);
pwmWrite(sr5,255);
for (int i=0; i<255; i++){
pwmWrite(sr3,i);
delay(1);
}
} else { //booted down animation
pwmWrite(sr1, 255);
pwmWrite(sr2, 255);
pwmWrite(sr3, 255);
pwmWrite(sr4,255);
pwmWrite(sr5,255);
//blink leds 100%
if (TICK >= 1020){
TICK = 0;
pwmWrite(sr6,0);
}
else{
TICK++;
delay(1);
if (TICK == 600){
pwmWrite(sr6,255);
}
if (TICK == 660){
pwmWrite(sr6,0);
}
if (TICK == 960){
pwmWrite(sr6,255);
}
if (TICK == 800){
pwmWrite(sr7,255);
}
if (TICK == 900){
pwmWrite(sr7,0);
}
if (TICK == 900){
pwmWrite(sr8,255);
}
if (TICK == 1000){
pwmWrite(sr8,0);
}
}
}
}
}
I get this error:
Using board 'ATtinyX5' from platform in folder: C:\Users\sbend\AppData\Local\Arduino15\packages\attiny\hardware\avr\1.0.2
Using core 'arduino' from platform in folder: C:\Users\sbend\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.5
Detecting libraries used...
"C:\\Users\\sbend\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=attiny85 -DF_CPU=8000000L -DARDUINO=10607 -DARDUINO_attiny -DARDUINO_ARCH_AVR "-IC:\\Users\\sbend\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.5\\cores\\arduino" "-IC:\\Users\\sbend\\AppData\\Local\\Arduino15\\packages\\attiny\\hardware\\avr\\1.0.2\\variants\\tiny8" "C:\\Users\\sbend\\AppData\\Local\\Temp\\arduino-sketch-5D89230CFB2F73EADE499FEC1CE8397E\\sketch\\74hc595_attiny_test_v3.ino.cpp" -o nul
Alternatives for TimerOne.h: [TimerOne@1.1]
ResolveLibrary(TimerOne.h)
-> candidates: [TimerOne@1.1]
"C:\\Users\\sbend\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=attiny85 -DF_CPU=8000000L -DARDUINO=10607 -DARDUINO_attiny -DARDUINO_ARCH_AVR "-IC:\\Users\\sbend\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.5\\cores\\arduino" "-IC:\\Users\\sbend\\AppData\\Local\\Arduino15\\packages\\attiny\\hardware\\avr\\1.0.2\\variants\\tiny8" "-Ic:\\Users\\sbend\\Documents\\Arduino\\libraries\\TimerOne" "C:\\Users\\sbend\\AppData\\Local\\Temp\\arduino-sketch-5D89230CFB2F73EADE499FEC1CE8397E\\sketch\\74hc595_attiny_test_v3.ino.cpp" -o nul
"C:\\Users\\sbend\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=attiny85 -DF_CPU=8000000L -DARDUINO=10607 -DARDUINO_attiny -DARDUINO_ARCH_AVR "-IC:\\Users\\sbend\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.5\\cores\\arduino" "-IC:\\Users\\sbend\\AppData\\Local\\Arduino15\\packages\\attiny\\hardware\\avr\\1.0.2\\variants\\tiny8" "-Ic:\\Users\\sbend\\Documents\\Arduino\\libraries\\TimerOne" "c:\\Users\\sbend\\Documents\\Arduino\\libraries\\TimerOne\\TimerOne.cpp" -o nul
Generating function prototypes...
"C:\\Users\\sbend\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=attiny85 -DF_CPU=8000000L -DARDUINO=10607 -DARDUINO_attiny -DARDUINO_ARCH_AVR "-IC:\\Users\\sbend\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.5\\cores\\arduino" "-IC:\\Users\\sbend\\AppData\\Local\\Arduino15\\packages\\attiny\\hardware\\avr\\1.0.2\\variants\\tiny8" "-Ic:\\Users\\sbend\\Documents\\Arduino\\libraries\\TimerOne" "C:\\Users\\sbend\\AppData\\Local\\Temp\\arduino-sketch-5D89230CFB2F73EADE499FEC1CE8397E\\sketch\\74hc595_attiny_test_v3.ino.cpp" -o "C:\\Users\\sbend\\AppData\\Local\\Temp\\arduino-sketch-5D89230CFB2F73EADE499FEC1CE8397E\\preproc\\ctags_target_for_gcc_minus_e.cpp"
"C:\\Users\\sbend\\AppData\\Local\\Arduino15\\packages\\builtin\\tools\\ctags\\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\\Users\\sbend\\AppData\\Local\\Temp\\arduino-sketch-5D89230CFB2F73EADE499FEC1CE8397E\\preproc\\ctags_target_for_gcc_minus_e.cpp"
In file included from C:\Users\sbend\Documents\Arduino\74hc595_attiny_test_v3\74hc595_attiny_test_v3.ino:11:0:
c:\Users\sbend\Documents\Arduino\libraries\TimerOne/TimerOne.h: In member function 'void TimerOne::initialize(long unsigned int)':
c:\Users\sbend\Documents\Arduino\libraries\TimerOne/TimerOne.h:47:2: error: 'TCCR1B' was not declared in this scope
TCCR1B = _BV(WGM13); // set mode as phase and frequency correct pwm, stop the timer
^~~~~~
Compiling sketch...
"C:\\Users\\sbend\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=attiny85 -DF_CPU=8000000L -DARDUINO=10607 -DARDUINO_attiny -DARDUINO_ARCH_AVR "-IC:\\Users\\sbend\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.5\\cores\\arduino" "-IC:\\Users\\sbend\\AppData\\Local\\Arduino15\\packages\\attiny\\hardware\\avr\\1.0.2\\variants\\tiny8" "-Ic:\\Users\\sbend\\Documents\\Arduino\\libraries\\TimerOne" "C:\\Users\\sbend\\AppData\\Local\\Temp\\arduino-sketch-5D89230CFB2F73EADE499FEC1CE8397E\\sketch\\74hc595_attiny_test_v3.ino.cpp" -o "C:\\Users\\sbend\\AppData\\Local\\Temp\\arduino-sketch-5D89230CFB2F73EADE499FEC1CE8397E\\sketch\\74hc595_attiny_test_v3.ino.cpp.o"
c:\Users\sbend\Documents\Arduino\libraries\TimerOne/TimerOne.h:47:2: note: suggested alternative: 'TCCR0B'
TCCR1B = _BV(WGM13); // set mode as phase and frequency correct pwm, stop the timer
^~~~~~
TCCR0B
In file included from c:\users\sbend\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\avr\include\avr\io.h:99:0,
from c:\users\sbend\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\avr\include\avr\pgmspace.h:90,
from C:\Users\sbend\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.5\cores\arduino/Arduino.h:28,
from C:\Users\sbend\AppData\Local\Temp\arduino-sketch-5D89230CFB2F73EADE499FEC1CE8397E\sketch\74hc595_attiny_test_v3.ino.cpp:1:
c:\Users\sbend\Documents\Arduino\libraries\TimerOne/TimerOne.h:47:15: error: 'WGM13' was not declared in this scope
TCCR1B = _BV(WGM13); // set mode as phase and frequency correct pwm, stop the timer
^
c:\Users\sbend\Documents\Arduino\libraries\TimerOne/TimerOne.h:47:15: note: suggested alternative: 'WGM00'
In file included from C:\Users\sbend\Documents\Arduino\74hc595_attiny_test_v3\74hc595_attiny_test_v3.ino:11:0:
c:\Users\sbend\Documents\Arduino\libraries\TimerOne/TimerOne.h: In member function 'void TimerOne::setPeriod(long unsigned int)':
c:\Users\sbend\Documents\Arduino\libraries\TimerOne/TimerOne.h:76:2: error: 'ICR1' was not declared in this scope
ICR1 = pwmPeriod;
^~~~
c:\Users\sbend\Documents\Arduino\libraries\TimerOne/TimerOne.h:76:2: note: suggested alternative: 'OCR1C'
ICR1 = pwmPeriod;
^~~~
OCR1C
c:\Users\sbend\Documents\Arduino\libraries\TimerOne/TimerOne.h:77:2: error: 'TCCR1B' was not declared in this scope
TCCR1B = _BV(WGM13) | clockSelectBits;
^~~~~~
c:\Users\sbend\Documents\Arduino\libraries\TimerOne/TimerOne.h:77:2: note: suggested alternative: 'TCCR0B'
TCCR1B = _BV(WGM13) | clockSelectBits;
^~~~~~
TCCR0B
In file included from c:\users\sbend\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\avr\include\avr\io.h:99:0,
from c:\users\sbend\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\avr\include\avr\pgmspace.h:90,
from C:\Users\sbend\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.5\cores\arduino/Arduino.h:28,
from C:\Users\sbend\AppData\Local\Temp\arduino-sketch-5D89230CFB2F73EADE499FEC1CE8397E\sketch\74hc595_attiny_test_v3.ino.cpp:1:
c:\Users\sbend\Documents\Arduino\libraries\TimerOne/TimerOne.h:77:15: error: 'WGM13' was not declared in this scope
TCCR1B = _BV(WGM13) | clockSelectBits;
^
c:\Users\sbend\Documents\Arduino\libraries\TimerOne/TimerOne.h:77:15: note: suggested alternative: 'WGM00'
In file included from C:\Users\sbend\Documents\Arduino\74hc595_attiny_test_v3\74hc595_attiny_test_v3.ino:11:0:
c:\Users\sbend\Documents\Arduino\libraries\TimerOne/TimerOne.h: In member function 'void TimerOne::start()':
c:\Users\sbend\Documents\Arduino\libraries\TimerOne/TimerOne.h:84:2: error: 'TCCR1B' was not declared in this scope
TCCR1B = 0;
^~~~~~
c:\Users\sbend\Documents\Arduino\libraries\TimerOne/TimerOne.h:84:2: note: suggested alternative: 'TCCR0B'
TCCR1B = 0;
^~~~~~
TCCR0B
c:\Users\sbend\Documents\Arduino\libraries\TimerOne/TimerOne.h: In member function 'void TimerOne::stop()':
c:\Users\sbend\Documents\Arduino\libraries\TimerOne/TimerOne.h:89:2: error: 'TCCR1B' was not declared in this scope
TCCR1B = _BV(WGM13);
^~~~~~
c:\Users\sbend\Documents\Arduino\libraries\TimerOne/TimerOne.h:89:2: note: suggested alternative: 'TCCR0B'
TCCR1B = _BV(WGM13);
^~~~~~
TCCR0B
In file included from c:\users\sbend\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\avr\include\avr\io.h:99:0,
from c:\users\sbend\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\avr\include\avr\pgmspace.h:90,
from C:\Users\sbend\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.5\cores\arduino/Arduino.h:28,
from C:\Users\sbend\AppData\Local\Temp\arduino-sketch-5D89230CFB2F73EADE499FEC1CE8397E\sketch\74hc595_attiny_test_v3.ino.cpp:1:
c:\Users\sbend\Documents\Arduino\libraries\TimerOne/TimerOne.h:89:15: error: 'WGM13' was not declared in this scope
TCCR1B = _BV(WGM13);
^
c:\Users\sbend\Documents\Arduino\libraries\TimerOne/TimerOne.h:89:15: note: suggested alternative: 'WGM00'
In file included from C:\Users\sbend\Documents\Arduino\74hc595_attiny_test_v3\74hc595_attiny_test_v3.ino:11:0:
c:\Users\sbend\Documents\Arduino\libraries\TimerOne/TimerOne.h: In member function 'void TimerOne::resume()':
c:\Users\sbend\Documents\Arduino\libraries\TimerOne/TimerOne.h:95:2: error: 'TCCR1B' was not declared in this scope
TCCR1B = _BV(WGM13) | clockSelectBits;
^~~~~~
c:\Users\sbend\Documents\Arduino\libraries\TimerOne/TimerOne.h:95:2: note: suggested alternative: 'TCCR0B'
TCCR1B = _BV(WGM13) | clockSelectBits;
^~~~~~
TCCR0B
In file included from c:\users\sbend\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\avr\include\avr\io.h:99:0,
from c:\users\sbend\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\avr\include\avr\pgmspace.h:90,
from C:\Users\sbend\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.5\cores\arduino/Arduino.h:28,
from C:\Users\sbend\AppData\Local\Temp\arduino-sketch-5D89230CFB2F73EADE499FEC1CE8397E\sketch\74hc595_attiny_test_v3.ino.cpp:1:
c:\Users\sbend\Documents\Arduino\libraries\TimerOne/TimerOne.h:95:15: error: 'WGM13' was not declared in this scope
TCCR1B = _BV(WGM13) | clockSelectBits;
^
c:\Users\sbend\Documents\Arduino\libraries\TimerOne/TimerOne.h:95:15: note: suggested alternative: 'WGM00'
In file included from C:\Users\sbend\Documents\Arduino\74hc595_attiny_test_v3\74hc595_attiny_test_v3.ino:11:0:
c:\Users\sbend\Documents\Arduino\libraries\TimerOne/TimerOne.h: In member function 'void TimerOne::setPwmDuty(char, unsigned int)':
c:\Users\sbend\Documents\Arduino\libraries\TimerOne/TimerOne.h:105:13: error: 'TIMER1_A_PIN' was not declared in this scope
if (pin == TIMER1_A_PIN) OCR1A = dutyCycle;
^~~~~~~~~~~~
c:\Users\sbend\Documents\Arduino\libraries\TimerOne/TimerOne.h:105:13: note: suggested alternative: 'TIMER1A'
if (pin == TIMER1_A_PIN) OCR1A = dutyCycle;
^~~~~~~~~~~~
TIMER1A
c:\Users\sbend\Documents\Arduino\libraries\TimerOne/TimerOne.h: In member function 'void TimerOne::pwm(char, unsigned int)':
c:\Users\sbend\Documents\Arduino\libraries\TimerOne/TimerOne.h:114:13: error: 'TIMER1_A_PIN' was not declared in this scope
if (pin == TIMER1_A_PIN) { pinMode(TIMER1_A_PIN, OUTPUT); TCCR1A |= _BV(COM1A1); }
^~~~~~~~~~~~
c:\Users\sbend\Documents\Arduino\libraries\TimerOne/TimerOne.h:114:13: note: suggested alternative: 'TIMER1A'
if (pin == TIMER1_A_PIN) { pinMode(TIMER1_A_PIN, OUTPUT); TCCR1A |= _BV(COM1A1); }
^~~~~~~~~~~~
TIMER1A
c:\Users\sbend\Documents\Arduino\libraries\TimerOne/TimerOne.h:122:2: error: 'TCCR1B' was not declared in this scope
TCCR1B = _BV(WGM13) | clockSelectBits;
^~~~~~
c:\Users\sbend\Documents\Arduino\libraries\TimerOne/TimerOne.h:122:2: note: suggested alternative: 'TCCR0B'
TCCR1B = _BV(WGM13) | clockSelectBits;
^~~~~~
TCCR0B
In file included from c:\users\sbend\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\avr\include\avr\io.h:99:0,
from c:\users\sbend\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\avr\include\avr\pgmspace.h:90,
from C:\Users\sbend\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.5\cores\arduino/Arduino.h:28,
from C:\Users\sbend\AppData\Local\Temp\arduino-sketch-5D89230CFB2F73EADE499FEC1CE8397E\sketch\74hc595_attiny_test_v3.ino.cpp:1:
c:\Users\sbend\Documents\Arduino\libraries\TimerOne/TimerOne.h:122:15: error: 'WGM13' was not declared in this scope
TCCR1B = _BV(WGM13) | clockSelectBits;
^
c:\Users\sbend\Documents\Arduino\libraries\TimerOne/TimerOne.h:122:15: note: suggested alternative: 'WGM00'
In file included from C:\Users\sbend\Documents\Arduino\74hc595_attiny_test_v3\74hc595_attiny_test_v3.ino:11:0:
c:\Users\sbend\Documents\Arduino\libraries\TimerOne/TimerOne.h: In member function 'void TimerOne::disablePwm(char)':
c:\Users\sbend\Documents\Arduino\libraries\TimerOne/TimerOne.h:129:13: error: 'TIMER1_A_PIN' was not declared in this scope
if (pin == TIMER1_A_PIN) TCCR1A &= ~_BV(COM1A1);
^~~~~~~~~~~~
c:\Users\sbend\Documents\Arduino\libraries\TimerOne/TimerOne.h:129:13: note: suggested alternative: 'TIMER1A'
if (pin == TIMER1_A_PIN) TCCR1A &= ~_BV(COM1A1);
^~~~~~~~~~~~
TIMER1A
c:\Users\sbend\Documents\Arduino\libraries\TimerOne/TimerOne.h: In member function 'void TimerOne::attachInterrupt(void (*)())':
c:\Users\sbend\Documents\Arduino\libraries\TimerOne/TimerOne.h:143:2: error: 'TIMSK1' was not declared in this scope
TIMSK1 = _BV(TOIE1);
^~~~~~
c:\Users\sbend\Documents\Arduino\libraries\TimerOne/TimerOne.h:143:2: note: suggested alternative: 'TIMSK'
TIMSK1 = _BV(TOIE1);
^~~~~~
TIMSK
c:\Users\sbend\Documents\Arduino\libraries\TimerOne/TimerOne.h: In member function 'void TimerOne::detachInterrupt()':
c:\Users\sbend\Documents\Arduino\libraries\TimerOne/TimerOne.h:150:2: error: 'TIMSK1' was not declared in this scope
TIMSK1 = 0;
^~~~~~
c:\Users\sbend\Documents\Arduino\libraries\TimerOne/TimerOne.h:150:2: note: suggested alternative: 'TIMSK'
TIMSK1 = 0;
^~~~~~
TIMSK
C:\Users\sbend\Documents\Arduino\74hc595_attiny_test_v3\74hc595_attiny_test_v3.ino: In function 'void setupSPI()':
C:\Users\sbend\Documents\Arduino\74hc595_attiny_test_v3\74hc595_attiny_test_v3.ino:129:3: error: 'SPCR' was not declared in this scope
SPCR |= ((1 << SPE) | (1 << MSTR)); // enable SPI as master
^~~~
C:\Users\sbend\Documents\Arduino\74hc595_attiny_test_v3\74hc595_attiny_test_v3.ino:129:3: note: suggested alternative: 'EECR'
SPCR |= ((1 << SPE) | (1 << MSTR)); // enable SPI as master
^~~~
EECR
C:\Users\sbend\Documents\Arduino\74hc595_attiny_test_v3\74hc595_attiny_test_v3.ino:129:18: error: 'SPE' was not declared in this scope
SPCR |= ((1 << SPE) | (1 << MSTR)); // enable SPI as master
^~~
C:\Users\sbend\Documents\Arduino\74hc595_attiny_test_v3\74hc595_attiny_test_v3.ino:129:18: note: suggested alternative: 'SPH'
SPCR |= ((1 << SPE) | (1 << MSTR)); // enable SPI as master
^~~
SPH
C:\Users\sbend\Documents\Arduino\74hc595_attiny_test_v3\74hc595_attiny_test_v3.ino:129:31: error: 'MSTR' was not declared in this scope
SPCR |= ((1 << SPE) | (1 << MSTR)); // enable SPI as master
^~~~
C:\Users\sbend\Documents\Arduino\74hc595_attiny_test_v3\74hc595_attiny_test_v3.ino:129:31: note: suggested alternative: 'PSTR'
SPCR |= ((1 << SPE) | (1 << MSTR)); // enable SPI as master
^~~~
PSTR
C:\Users\sbend\Documents\Arduino\74hc595_attiny_test_v3\74hc595_attiny_test_v3.ino:131:19: error: 'SPR1' was not declared in this scope
SPCR &= ~((1 << SPR1) | (1 << SPR0)); // clear prescaler bits
^~~~
C:\Users\sbend\Documents\Arduino\74hc595_attiny_test_v3\74hc595_attiny_test_v3.ino:131:19: note: suggested alternative: 'SM1'
SPCR &= ~((1 << SPR1) | (1 << SPR0)); // clear prescaler bits
^~~~
SM1
C:\Users\sbend\Documents\Arduino\74hc595_attiny_test_v3\74hc595_attiny_test_v3.ino:131:33: error: 'SPR0' was not declared in this scope
SPCR &= ~((1 << SPR1) | (1 << SPR0)); // clear prescaler bits
^~~~
C:\Users\sbend\Documents\Arduino\74hc595_attiny_test_v3\74hc595_attiny_test_v3.ino:131:33: note: suggested alternative: 'SM0'
SPCR &= ~((1 << SPR1) | (1 << SPR0)); // clear prescaler bits
^~~~
SM0
C:\Users\sbend\Documents\Arduino\74hc595_attiny_test_v3\74hc595_attiny_test_v3.ino:132:9: error: 'SPSR' was not declared in this scope
clr = SPSR; // clear SPI status reg
^~~~
C:\Users\sbend\Documents\Arduino\74hc595_attiny_test_v3\74hc595_attiny_test_v3.ino:132:9: note: suggested alternative: 'ACSR'
clr = SPSR; // clear SPI status reg
^~~~
ACSR
C:\Users\sbend\Documents\Arduino\74hc595_attiny_test_v3\74hc595_attiny_test_v3.ino:133:9: error: 'SPDR' was not declared in this scope
clr = SPDR; // clear SPI data reg
^~~~
C:\Users\sbend\Documents\Arduino\74hc595_attiny_test_v3\74hc595_attiny_test_v3.ino:133:9: note: suggested alternative: 'EEDR'
clr = SPDR; // clear SPI data reg
^~~~
EEDR
C:\Users\sbend\Documents\Arduino\74hc595_attiny_test_v3\74hc595_attiny_test_v3.ino:134:17: error: 'SPI2X' was not declared in this scope
SPSR |= (1 << SPI2X); // set prescaler bits
^~~~~
C:\Users\sbend\Documents\Arduino\74hc595_attiny_test_v3\74hc595_attiny_test_v3.ino: In function 'byte spi_transfer(byte)':
C:\Users\sbend\Documents\Arduino\74hc595_attiny_test_v3\74hc595_attiny_test_v3.ino:142:3: error: 'SPDR' was not declared in this scope
SPDR = data; // Start the transmission
^~~~
C:\Users\sbend\Documents\Arduino\74hc595_attiny_test_v3\74hc595_attiny_test_v3.ino:142:3: note: suggested alternative: 'EEDR'
SPDR = data; // Start the transmission
^~~~
EEDR
In file included from c:\users\sbend\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\avr\include\avr\io.h:99:0,
from c:\users\sbend\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\avr\include\avr\pgmspace.h:90,
from C:\Users\sbend\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.5\cores\arduino/Arduino.h:28,
from C:\Users\sbend\AppData\Local\Temp\arduino-sketch-5D89230CFB2F73EADE499FEC1CE8397E\sketch\74hc595_attiny_test_v3.ino.cpp:1:
C:\Users\sbend\Documents\Arduino\74hc595_attiny_test_v3\74hc595_attiny_test_v3.ino:143:25: error: 'SPSR' was not declared in this scope
loop_until_bit_is_set(SPSR, SPIF);
^
C:\Users\sbend\Documents\Arduino\74hc595_attiny_test_v3\74hc595_attiny_test_v3.ino:143:25: note: suggested alternative: 'ACSR'
C:\Users\sbend\Documents\Arduino\74hc595_attiny_test_v3\74hc595_attiny_test_v3.ino:143:31: error: 'SPIF' was not declared in this scope
loop_until_bit_is_set(SPSR, SPIF);
^
C:\Users\sbend\Documents\Arduino\74hc595_attiny_test_v3\74hc595_attiny_test_v3.ino:143:31: note: suggested alternative: 'WDIF'
C:\Users\sbend\Documents\Arduino\74hc595_attiny_test_v3\74hc595_attiny_test_v3.ino: In function 'void setup()':
C:\Users\sbend\Documents\Arduino\74hc595_attiny_test_v3\74hc595_attiny_test_v3.ino:149:3: error: 'Serial' was not declared in this scope
Serial.begin(9600);
^~~~~~
C:\Users\sbend\Documents\Arduino\74hc595_attiny_test_v3\74hc595_attiny_test_v3.ino:149:3: note: suggested alternative: 'Stream'
Serial.begin(9600);
^~~~~~
Stream
Using library TimerOne at version 1.1 in folder: C:\Users\sbend\Documents\Arduino\libraries\TimerOne
exit status 1
Compilation error: 'SPCR' was not declared in this scope
Can someone help me please? I honestly dont really know what i'm doing here and what i need to do to make this work.