Hi I am trying to make this battle bot and i got it all to work fine on my arduino unos but when I tried compiling it for a attiny88 i get this error
Arduino: 1.8.19 (Windows Store 1.8.57.0) (Windows 10), Board: "ATtiny88 (Micronucleus, MH-ET t88 w/16MHz CLOCK), Enabled, 16 MHz (external 16MHz, USB), MH Tiny, B.O.D. Enabled (4.3v), Reset, Upgrade (via USB, fuses unchanged), Always, Enabled, Port A (pins 23~26)"
In file included from C:\Users\Nate\Documents\Arduino\libraries\SoftPWM\SoftPWM.cpp:
44:0:
C:\Users\Nate\Documents\Arduino\libraries\SoftPWM\SoftPWM.cpp: In function 'void SoftPWMBegin(uint8_t)':
C:\Users\Nate\Documents\Arduino\libraries\SoftPWM\SoftPWM_timer.h:39:3: error: 'TIFR2' was not declared in this scope
TIFR2 = (1 << TOV2); /* clear interrupt flag */ \
^
C:\Users\Nate\Documents\Arduino\libraries\SoftPWM\SoftPWM.cpp:171:3: note: in expansion of macro 'SOFTPWM_TIMER_INIT'
SOFTPWM_TIMER_INIT(SOFTPWM_OCR);
^~~~~~~~~~~~~~~~~~
C:\Users\Nate\Documents\Arduino\libraries\SoftPWM\SoftPWM_timer.h:39:3: note: suggested alternative: 'TIFR0'
TIFR2 = (1 << TOV2); /* clear interrupt flag */ \
^
C:\Users\Nate\Documents\Arduino\libraries\SoftPWM\SoftPWM.cpp:171:3: note: in expansion of macro 'SOFTPWM_TIMER_INIT'
SOFTPWM_TIMER_INIT(SOFTPWM_OCR);
^~~~~~~~~~~~~~~~~~
C:\Users\Nate\Documents\Arduino\libraries\SoftPWM\SoftPWM_timer.h:39:17: error: 'TOV2' was not declared in this scope
TIFR2 = (1 << TOV2); /* clear interrupt flag */ \
^
C:\Users\Nate\Documents\Arduino\libraries\SoftPWM\SoftPWM.cpp:171:3: note: in expansion of macro 'SOFTPWM_TIMER_INIT'
SOFTPWM_TIMER_INIT(SOFTPWM_OCR);
^~~~~~~~~~~~~~~~~~
C:\Users\Nate\Documents\Arduino\libraries\SoftPWM\SoftPWM_timer.h:39:17: note: suggested alternative: 'TOV0'
TIFR2 = (1 << TOV2); /* clear interrupt flag */ \
^
C:\Users\Nate\Documents\Arduino\libraries\SoftPWM\SoftPWM.cpp:171:3: note: in expansion of macro 'SOFTPWM_TIMER_INIT'
SOFTPWM_TIMER_INIT(SOFTPWM_OCR);
^~~~~~~~~~~~~~~~~~
C:\Users\Nate\Documents\Arduino\libraries\SoftPWM\SoftPWM_timer.h:40:3: error: 'TCCR2B' was not declared in this scope
TCCR2B = (1 << CS21); /* start timer (ck/8 prescalar) */ \
^
C:\Users\Nate\Documents\Arduino\libraries\SoftPWM\SoftPWM.cpp:171:3: note: in expansion of macro 'SOFTPWM_TIMER_INIT'
SOFTPWM_TIMER_INIT(SOFTPWM_OCR);
^~~~~~~~~~~~~~~~~~
C:\Users\Nate\Documents\Arduino\libraries\SoftPWM\SoftPWM_timer.h:40:3: note: suggested alternative: 'TCCR1B'
TCCR2B = (1 << CS21); /* start timer (ck/8 prescalar) */ \
^
C:\Users\Nate\Documents\Arduino\libraries\SoftPWM\SoftPWM.cpp:171:3: note: in expansion of macro 'SOFTPWM_TIMER_INIT'
SOFTPWM_TIMER_INIT(SOFTPWM_OCR);
^~~~~~~~~~~~~~~~~~
C:\Users\Nate\Documents\Arduino\libraries\SoftPWM\SoftPWM_timer.h:40:18: error: 'CS21' was not declared in this scope
TCCR2B = (1 << CS21); /* start timer (ck/8 prescalar) */ \
^
C:\Users\Nate\Documents\Arduino\libraries\SoftPWM\SoftPWM.cpp:171:3: note: in expansion of macro 'SOFTPWM_TIMER_INIT'
SOFTPWM_TIMER_INIT(SOFTPWM_OCR);
^~~~~~~~~~~~~~~~~~
C:\Users\Nate\Documents\Arduino\libraries\SoftPWM\SoftPWM_timer.h:40:18: note: suggested alternative: 'CS01'
TCCR2B = (1 << CS21); /* start timer (ck/8 prescalar) */ \
^
C:\Users\Nate\Documents\Arduino\libraries\SoftPWM\SoftPWM.cpp:171:3: note: in expansion of macro 'SOFTPWM_TIMER_INIT'
SOFTPWM_TIMER_INIT(SOFTPWM_OCR);
^~~~~~~~~~~~~~~~~~
C:\Users\Nate\Documents\Arduino\libraries\SoftPWM\SoftPWM_timer.h:41:3: error: 'TCCR2A' was not declared in this scope
TCCR2A = (1 << WGM21); /* CTC mode */ \
^
C:\Users\Nate\Documents\Arduino\libraries\SoftPWM\SoftPWM.cpp:171:3: note: in expansion of macro 'SOFTPWM_TIMER_INIT'
SOFTPWM_TIMER_INIT(SOFTPWM_OCR);
^~~~~~~~~~~~~~~~~~
C:\Users\Nate\Documents\Arduino\libraries\SoftPWM\SoftPWM_timer.h:41:3: note: suggested alternative: 'TCCR0A'
TCCR2A = (1 << WGM21); /* CTC mode */ \
^
C:\Users\Nate\Documents\Arduino\libraries\SoftPWM\SoftPWM.cpp:171:3: note: in expansion of macro 'SOFTPWM_TIMER_INIT'
SOFTPWM_TIMER_INIT(SOFTPWM_OCR);
^~~~~~~~~~~~~~~~~~
C:\Users\Nate\Documents\Arduino\libraries\SoftPWM\SoftPWM_timer.h:41:18: error: 'WGM21' was not declared in this scope
TCCR2A = (1 << WGM21); /* CTC mode */ \
^
C:\Users\Nate\Documents\Arduino\libraries\SoftPWM\SoftPWM.cpp:171:3: note: in expansion of macro 'SOFTPWM_TIMER_INIT'
SOFTPWM_TIMER_INIT(SOFTPWM_OCR);
^~~~~~~~~~~~~~~~~~
C:\Users\Nate\Documents\Arduino\libraries\SoftPWM\SoftPWM_timer.h:41:18: note: suggested alternative: 'WGM11'
TCCR2A = (1 << WGM21); /* CTC mode */ \
^
C:\Users\Nate\Documents\Arduino\libraries\SoftPWM\SoftPWM.cpp:171:3: note: in expansion of macro 'SOFTPWM_TIMER_INIT'
SOFTPWM_TIMER_INIT(SOFTPWM_OCR);
^~~~~~~~~~~~~~~~~~
C:\Users\Nate\Documents\Arduino\libraries\SoftPWM\SoftPWM_timer.h:42:3: error: 'OCR2A' was not declared in this scope
OCR2A = (ocr); /* We want to have at least 30Hz or else it gets choppy */ \
^
C:\Users\Nate\Documents\Arduino\libraries\SoftPWM\SoftPWM.cpp:171:3: note: in expansion of macro 'SOFTPWM_TIMER_INIT'
SOFTPWM_TIMER_INIT(SOFTPWM_OCR);
^~~~~~~~~~~~~~~~~~
C:\Users\Nate\Documents\Arduino\libraries\SoftPWM\SoftPWM_timer.h:42:3: note: suggested alternative: 'OCR0A'
OCR2A = (ocr); /* We want to have at least 30Hz or else it gets choppy */ \
^
C:\Users\Nate\Documents\Arduino\libraries\SoftPWM\SoftPWM.cpp:171:3: note: in expansion of macro 'SOFTPWM_TIMER_INIT'
SOFTPWM_TIMER_INIT(SOFTPWM_OCR);
^~~~~~~~~~~~~~~~~~
C:\Users\Nate\Documents\Arduino\libraries\SoftPWM\SoftPWM_timer.h:43:3: error: 'TIMSK2' was not declared in this scope
TIMSK2 = (1 << OCIE2A); /* enable timer2 output compare match interrupt */ \
^
C:\Users\Nate\Documents\Arduino\libraries\SoftPWM\SoftPWM.cpp:171:3: note: in expansion of macro 'SOFTPWM_TIMER_INIT'
SOFTPWM_TIMER_INIT(SOFTPWM_OCR);
^~~~~~~~~~~~~~~~~~
C:\Users\Nate\Documents\Arduino\libraries\SoftPWM\SoftPWM_timer.h:43:3: note: suggested alternative: 'TIMSK0'
TIMSK2 = (1 << OCIE2A); /* enable timer2 output compare match interrupt */ \
^
C:\Users\Nate\Documents\Arduino\libraries\SoftPWM\SoftPWM.cpp:171:3: note: in expansion of macro 'SOFTPWM_TIMER_INIT'
SOFTPWM_TIMER_INIT(SOFTPWM_OCR);
^~~~~~~~~~~~~~~~~~
C:\Users\Nate\Documents\Arduino\libraries\SoftPWM\SoftPWM_timer.h:43:18: error: 'OCIE2A' was not declared in this scope
TIMSK2 = (1 << OCIE2A); /* enable timer2 output compare match interrupt */ \
^
C:\Users\Nate\Documents\Arduino\libraries\SoftPWM\SoftPWM.cpp:171:3: note: in expansion of macro 'SOFTPWM_TIMER_INIT'
SOFTPWM_TIMER_INIT(SOFTPWM_OCR);
^~~~~~~~~~~~~~~~~~
C:\Users\Nate\Documents\Arduino\libraries\SoftPWM\SoftPWM_timer.h:43:18: note: suggested alternative: 'OCIE0A'
TIMSK2 = (1 << OCIE2A); /* enable timer2 output compare match interrupt */ \
^
C:\Users\Nate\Documents\Arduino\libraries\SoftPWM\SoftPWM.cpp:171:3: note: in expansion of macro 'SOFTPWM_TIMER_INIT'
SOFTPWM_TIMER_INIT(SOFTPWM_OCR);
^~~~~~~~~~~~~~~~~~
C:\Users\Nate\Documents\Arduino\libraries\SoftPWM\SoftPWM.cpp: In function 'void SoftPWMSet(int8_t, uint8_t, uint8_t)':
C:\Users\Nate\Documents\Arduino\libraries\SoftPWM\SoftPWM_timer.h:37:37: error: 'TCNT2' was not declared in this scope
#define SOFTPWM_TIMER_SET(val) (TCNT2 = (val))
^
C:\Users\Nate\Documents\Arduino\libraries\SoftPWM\SoftPWM.cpp:220:5: note: in expansion of macro 'SOFTPWM_TIMER_SET'
SOFTPWM_TIMER_SET(0); ^~~~~~~~~~~~~~~~~
C:\Users\Nate\Documents\Arduino\libraries\SoftPWM\SoftPWM_timer.h:37:37: note: suggested alternative: 'TCNT0'
#define SOFTPWM_TIMER_SET(val) (TCNT2 = (val))
^
C:\Users\Nate\Documents\Arduino\libraries\SoftPWM\SoftPWM.cpp:220:5: note: in expansion of macro 'SOFTPWM_TIMER_SET'
SOFTPWM_TIMER_SET(0); ^~~~~~~~~~~~~~~~~
exit status 1
Error compiling for board ATtiny88 (Micronucleus, MH-ET t88 w/16MHz CLOCK).
This is the code im using
[code]
#include <SoftPWM.h>
#include <SoftPWM_timer.h>
#include <nRF24L01.h>
#include <printf.h>
#include <RF24.h>
#include <RF24_config.h>
RF24 radio(9,10);
const uint64_t pipe = 0xE8E8F0F0E1LL;
uint8_t msg[5];
int leftFor = 2;
int leftBack=3;
int rightFor = 4;
int rightBack=5;
int data;
int dataLF;
int dataLB;
int dataRF;
int dataRB;
void setup() {
// put your setup code here, to run once:
radio.begin();
radio.openReadingPipe(1,pipe);
radio.startListening();
SoftPWMBegin();
SoftPWMSet(leftFor, 0);
SoftPWMSet(leftBack, 0);
SoftPWMSet(rightFor, 0);
SoftPWMSet(rightBack, 0);
}
void loop() {
//if signal from the radio move the bot, otherwise fail to an "all off" condition
if (radio.available()){
radio.read(msg,5);
dataLF=msg[0];
dataLB=msg[1];
dataRF=msg[2];
dataRB=msg[3];
data=msg[4];
//analogWrite(motor,data);
if((dataLF>0&&dataLB>0)||(dataRF>0&&dataRB>0)){
//error condition (attempting to put pwm signal into both forwards and backwards at the same time)
Serial.println("BOTH ABOVE ERROR");
SoftPWMSet(leftFor, 0);
SoftPWMSet(leftBack, 0);
SoftPWMSet(rightFor, 0);
SoftPWMSet(rightBack, 0);
}else{
SoftPWMSet(leftFor, dataLF);
SoftPWMSet(leftBack, dataLB);
SoftPWMSet(rightFor, dataRF);
SoftPWMSet(rightBack, dataRB);
}
}else{
//No signal from radio, this can happen if the radio is transmitting too slowly
//either reduce the delay in the tx code or increase the delay below
SoftPWMSet(leftFor, 0);
SoftPWMSet(leftBack, 0);
SoftPWMSet(rightFor, 0);
SoftPWMSet(rightBack, 0);
}
//delay for sinking with the tx, adjust as needed
delay(20);
}
[/code]
This is the specs from the manufacturer on the board
- Support for the Ardu-ino IDE 1.0+ (OSX/Win/Linux)
- Power via USB or External Source - 5v or 7-35v (12v or less recommended automatic selection)
- On-board 500ma 5V regulator
- Built-in USB
- 26 I/O Pins (2 are used for USB only if your program actively communicates over USB, otherwise you can use all 6 even if you are programming via USB)
- 8k flash memory (about 6k after bootloader)
- I2C and SPI
- 26-PWM (26 pins with Software PWM*,only two(D9,D10) with hardware PWM )
- ADC on 8 pins
- Power LED and Test/Status LED
- Package: 10PCS ATTINY88 Microcontroller Development Board
Notice how it says 26 pins with Software PWM so I don't get what the problem is
I'm open to any suggestions ya'll have!