Hello,
I am trying to upgrade Arduinos used in a project because of the builtin bluetooth and faster clock on the Nano 33 IOT. I am using the sketch from Rysium (http://rysium.com/images/stories/projects/story_arduino-dro/download/ArduinoDRO_Tach_V5_12.ino)
which will load and produce the serial output when I use my Arduino Uno. I bought the Nano 33 IOT for the builtin bluetooth and now when I load the code, I get:
Arduino: 1.8.9 (Mac OS X), Board: "Arduino NANO 33 IoT"
Arduino_DRO_V5_12:819:5: error: expected constructor, destructor, or type conversion before '(' token
ISR(TIMER2_COMPB_vect) {
^
Arduino_DRO_V5_12:834:5: error: expected constructor, destructor, or type conversion before '(' token
ISR(TIMER2_COMPA_vect)
^
Arduino_DRO_V5_12:1193:5: error: expected constructor, destructor, or type conversion before '(' token
ISR(TACH_INTERRUPT_VECTOR)
^
/Users/danielabernathy/Documents/Arduino/Arduino_DRO_V5_12/Arduino_DRO_V5_12.ino: In function 'void setup()':
Arduino_DRO_V5_12:586:3: error: 'cli' was not declared in this scope
cli();
^~~
/Users/danielabernathy/Documents/Arduino/Arduino_DRO_V5_12/Arduino_DRO_V5_12.ino:586:3: note: suggested alternative: 'Gclk'
cli();
^~~
Gclk
Arduino_DRO_V5_12:305:23: error: 'DDRD' was not declared in this scope
#define SCALE_CLK_DDR DDRD
^
/Users/danielabernathy/Documents/Arduino/Arduino_DRO_V5_12/Arduino_DRO_V5_12.ino:595:3: note: in expansion of macro 'SCALE_CLK_DDR'
SCALE_CLK_DDR |= _BV(CLK_PIN_BIT);
^~~~~~~~~~~~~
Arduino_DRO_V5_12:595:20: error: '_BV' was not declared in this scope
SCALE_CLK_DDR |= _BV(CLK_PIN_BIT);
^~~
/Users/danielabernathy/Documents/Arduino/Arduino_DRO_V5_12/Arduino_DRO_V5_12.ino:595:20: note: suggested alternative: '_B'
SCALE_CLK_DDR |= _BV(CLK_PIN_BIT);
^~~
_B
Arduino_DRO_V5_12:306:31: error: 'PORTD' was not declared in this scope
#define SCALE_CLK_OUTPUT_PORT PORTD
^
/Users/danielabernathy/Documents/Arduino/Arduino_DRO_V5_12/Arduino_DRO_V5_12.ino:597:3: note: in expansion of macro 'SCALE_CLK_OUTPUT_PORT'
SCALE_CLK_OUTPUT_PORT &= ~_BV(CLK_PIN_BIT);
^~~~~~~~~~~~~~~~~~~~~
/Users/danielabernathy/Documents/Arduino/Arduino_DRO_V5_12/Arduino_DRO_V5_12.ino:306:31: note: suggested alternative: 'PORTC'
#define SCALE_CLK_OUTPUT_PORT PORTD
^
/Users/danielabernathy/Documents/Arduino/Arduino_DRO_V5_12/Arduino_DRO_V5_12.ino:597:3: note: in expansion of macro 'SCALE_CLK_OUTPUT_PORT'
SCALE_CLK_OUTPUT_PORT &= ~_BV(CLK_PIN_BIT);
^~~~~~~~~~~~~~~~~~~~~
Arduino_DRO_V5_12:469:22: error: 'DDRB' was not declared in this scope
#define TACH_LED_DDR DDRB
^
/Users/danielabernathy/Documents/Arduino/Arduino_DRO_V5_12/Arduino_DRO_V5_12.ino:640:3: note: in expansion of macro 'TACH_LED_DDR'
TACH_LED_DDR |= _BV(TACH_LED_PIN_BIT);
^~~~~~~~~~~~
Arduino_DRO_V5_12:645:3: error: 'PCICR' was not declared in this scope
PCICR |= _BV(TACH_INTERRUPT_REGISTER);
^~~~~
Arduino_DRO_V5_12:404:33: error: 'PCIE2' was not declared in this scope
#define TACH_INTERRUPT_REGISTER PCIE2
^
/Users/danielabernathy/Documents/Arduino/Arduino_DRO_V5_12/Arduino_DRO_V5_12.ino:645:16: note: in expansion of macro 'TACH_INTERRUPT_REGISTER'
PCICR |= _BV(TACH_INTERRUPT_REGISTER);
^~~~~~~~~~~~~~~~~~~~~~~
/Users/danielabernathy/Documents/Arduino/Arduino_DRO_V5_12/Arduino_DRO_V5_12.ino:404:33: note: suggested alternative: 'PRIi32'
#define TACH_INTERRUPT_REGISTER PCIE2
^
/Users/danielabernathy/Documents/Arduino/Arduino_DRO_V5_12/Arduino_DRO_V5_12.ino:645:16: note: in expansion of macro 'TACH_INTERRUPT_REGISTER'
PCICR |= _BV(TACH_INTERRUPT_REGISTER);
^~~~~~~~~~~~~~~~~~~~~~~
Arduino_DRO_V5_12:405:29: error: 'PCMSK2' was not declared in this scope
#define TACH_INTERRUPT_MASK PCMSK2
^
/Users/danielabernathy/Documents/Arduino/Arduino_DRO_V5_12/Arduino_DRO_V5_12.ino:646:3: note: in expansion of macro 'TACH_INTERRUPT_MASK'
TACH_INTERRUPT_MASK |= _BV(TACH_INTERRUPT_PIN);
^~~~~~~~~~~~~~~~~~~
Arduino_DRO_V5_12:406:28: error: 'PCINT23' was not declared in this scope
#define TACH_INTERRUPT_PIN PCINT23
^
/Users/danielabernathy/Documents/Arduino/Arduino_DRO_V5_12/Arduino_DRO_V5_12.ino:646:30: note: in expansion of macro 'TACH_INTERRUPT_PIN'
TACH_INTERRUPT_MASK |= _BV(TACH_INTERRUPT_PIN);
^~~~~~~~~~~~~~~~~~
/Users/danielabernathy/Documents/Arduino/Arduino_DRO_V5_12/Arduino_DRO_V5_12.ino:406:28: note: suggested alternative: 'PIN_A3'
#define TACH_INTERRUPT_PIN PCINT23
^
/Users/danielabernathy/Documents/Arduino/Arduino_DRO_V5_12/Arduino_DRO_V5_12.ino:646:30: note: in expansion of macro 'TACH_INTERRUPT_PIN'
TACH_INTERRUPT_MASK |= _BV(TACH_INTERRUPT_PIN);
^~~~~~~~~~~~~~~~~~
Arduino_DRO_V5_12:686:3: error: 'sei' was not declared in this scope
sei();
^~~
/Users/danielabernathy/Documents/Arduino/Arduino_DRO_V5_12/Arduino_DRO_V5_12.ino: In function 'void setupClkTimer()':
Arduino_DRO_V5_12:786:3: error: 'TCCR2A' was not declared in this scope
TCCR2A = 0; // set entire TCCR2A register to 0
^~~~~~
/Users/danielabernathy/Documents/Arduino/Arduino_DRO_V5_12/Arduino_DRO_V5_12.ino:786:3: note: suggested alternative: 'TCC2'
TCCR2A = 0; // set entire TCCR2A register to 0
^~~~~~
TCC2
Arduino_DRO_V5_12:787:3: error: 'TCCR2B' was not declared in this scope
TCCR2B = 0; // same for TCCR2B
^~~~~~
/Users/danielabernathy/Documents/Arduino/Arduino_DRO_V5_12/Arduino_DRO_V5_12.ino:787:3: note: suggested alternative: 'TCC2'
TCCR2B = 0; // same for TCCR2B
^~~~~~
TCC2
Arduino_DRO_V5_12:791:3: error: 'OCR2A' was not declared in this scope
OCR2A = scaleClockDutyLimit; // default 44 = 22us
^~~~~
Arduino_DRO_V5_12:795:3: error: 'OCR2B' was not declared in this scope
OCR2B = clockCounterLimit; // default 222 = 111us
^~~~~
Arduino_DRO_V5_12:798:17: error: 'WGM21' was not declared in this scope
TCCR2A |= _BV(WGM21) | _BV(WGM20);
^~~~~
Arduino_DRO_V5_12:798:13: error: '_BV' was not declared in this scope
TCCR2A |= _BV(WGM21) | _BV(WGM20);
^~~
/Users/danielabernathy/Documents/Arduino/Arduino_DRO_V5_12/Arduino_DRO_V5_12.ino:798:13: note: suggested alternative: '_B'
TCCR2A |= _BV(WGM21) | _BV(WGM20);
^~~
_B
Arduino_DRO_V5_12:798:30: error: 'WGM20' was not declared in this scope
TCCR2A |= _BV(WGM21) | _BV(WGM20);
^~~~~
Arduino_DRO_V5_12:801:17: error: 'CS21' was not declared in this scope
TCCR2B |= _BV(CS21);
^~~~
/Users/danielabernathy/Documents/Arduino/Arduino_DRO_V5_12/Arduino_DRO_V5_12.ino:801:17: note: suggested alternative: 'SS1'
TCCR2B |= _BV(CS21);
^~~~
SS1
Arduino_DRO_V5_12:805:3: error: 'TCNT2' was not declared in this scope
TCNT2 = scaleClockDutyLimit + 1;
^~~~~
/Users/danielabernathy/Documents/Arduino/Arduino_DRO_V5_12/Arduino_DRO_V5_12.ino:805:3: note: suggested alternative: 'TCC2'
TCNT2 = scaleClockDutyLimit + 1;
^~~~~
TCC2
Arduino_DRO_V5_12:810:3: error: 'TIMSK2' was not declared in this scope
TIMSK2 |= _BV(OCIE2A) | _BV(OCIE2B);
^~~~~~
Arduino_DRO_V5_12:810:17: error: 'OCIE2A' was not declared in this scope
TIMSK2 |= _BV(OCIE2A) | _BV(OCIE2B);
^~~~~~
Arduino_DRO_V5_12:810:31: error: 'OCIE2B' was not declared in this scope
TIMSK2 |= _BV(OCIE2A) | _BV(OCIE2B);
^~~~~~
/Users/danielabernathy/Documents/Arduino/Arduino_DRO_V5_12/Arduino_DRO_V5_12.ino: At global scope:
Arduino_DRO_V5_12:819:4: error: expected constructor, destructor, or type conversion before '(' token
ISR(TIMER2_COMPB_vect) {
^
Arduino_DRO_V5_12:834:4: error: expected constructor, destructor, or type conversion before '(' token
ISR(TIMER2_COMPA_vect)
^
(Some error message deleted for post length)
Is this a C issue I don't understand (I am more Python and Matlab than C). I tried googling the issues and differences between programing ATMega and SAMD and found more about AVR, ARM, and processor differences.
Any help appreciated