We are trying to use our Arduino WiFi R4 as a receiver for our drone project, the signal comes from the flight controller and we want to use the arduino to transfer it with bluetooth to our phone using something like the Dabble app. The code we're using to achieve this comes from this tutorial: https://www.instructables.com/How-to-Control-Any-Drone-From-Your-Arduino-Microco/ . We are getting this error:
C:\Users\Admin\Downloads\Drone_Controller\Drone_Controller\PPMEncoder.cpp: In member function 'void PPMEncoder::begin(uint8_t, uint8_t, boolean)':
C:\Users\Admin\Downloads\Drone_Controller\Drone_Controller\PPMEncoder.cpp:39:3: error: 'TCCR1A' was not declared in this scope
TCCR1A = 0;
^~~~~~
C:\Users\Admin\Downloads\Drone_Controller\Drone_Controller\PPMEncoder.cpp:41:3: error: 'OCR1A' was not declared in this scope
OCR1A = 100;
^~~~~
C:\Users\Admin\Downloads\Drone_Controller\Drone_Controller\PPMEncoder.cpp:42:3: error: 'TCCR1B' was not declared in this scope
TCCR1B = (1 << WGM12) | (1 << CS11);
^~~~~~
C:\Users\Admin\Downloads\Drone_Controller\Drone_Controller\PPMEncoder.cpp:42:18: error: 'WGM12' was not declared in this scope
TCCR1B = (1 << WGM12) | (1 << CS11);
^~~~~
C:\Users\Admin\Downloads\Drone_Controller\Drone_Controller\PPMEncoder.cpp:42:33: error: 'CS11' was not declared in this scope
TCCR1B = (1 << WGM12) | (1 << CS11);
^~~~
C:\Users\Admin\Downloads\Drone_Controller\Drone_Controller\PPMEncoder.cpp:42:33: note: suggested alternative: 'CS'
TCCR1B = (1 << WGM12) | (1 << CS11);
^~~~
CS
C:\Users\Admin\Downloads\Drone_Controller\Drone_Controller\PPMEncoder.cpp:43:3: error: 'TIMSK1' was not declared in this scope
TIMSK1 = (1 << OCIE1A); // enable timer compare interrupt
^~~~~~
C:\Users\Admin\Downloads\Drone_Controller\Drone_Controller\PPMEncoder.cpp:43:18: error: 'OCIE1A' was not declared in this scope
TIMSK1 = (1 << OCIE1A); // enable timer compare interrupt
^~~~~~
C:\Users\Admin\Downloads\Drone_Controller\Drone_Controller\PPMEncoder.cpp: In member function 'void PPMEncoder::interrupt()':
C:\Users\Admin\Downloads\Drone_Controller\Drone_Controller\PPMEncoder.cpp:58:3: error: 'TCNT1' was not declared in this scope
TCNT1 = 0;
^~~~~
C:\Users\Admin\Downloads\Drone_Controller\Drone_Controller\PPMEncoder.cpp:58:3: note: suggested alternative: 'SCNd16'
TCNT1 = 0;
^~~~~
SCNd16
C:\Users\Admin\Downloads\Drone_Controller\Drone_Controller\PPMEncoder.cpp:62:5: error: 'OCR1A' was not declared in this scope
OCR1A = PPM_PULSE_LENGTH_uS * 2;
^~~~~
C:\Users\Admin\Downloads\Drone_Controller\Drone_Controller\PPMEncoder.cpp:70:7: error: 'OCR1A' was not declared in this scope
OCR1A = (PPM_FRAME_LENGTH_uS - elapsedUs) * 2 - err;
^~~~~
C:\Users\Admin\Downloads\Drone_Controller\Drone_Controller\PPMEncoder.cpp:73:7: error: 'OCR1A' was not declared in this scope
OCR1A = (channels[currentChannel] - PPM_PULSE_LENGTH_uS) * 2 - err;
^~~~~
C:\Users\Admin\Downloads\Drone_Controller\Drone_Controller\PPMEncoder.cpp: At global scope:
C:\Users\Admin\Downloads\Drone_Controller\Drone_Controller\PPMEncoder.cpp:83:4: error: expected constructor, destructor, or type conversion before '(' token
ISR(TIMER1_COMPA_vect) {
^
exit status 1
Compilation error: 'TCCR1A' was not declared in this scope
Our understanding of timer interupts is very limited but we've figured out that these timers can't be used for the R4 board and should be formed differently, this is the forum post: https://forum.arduino.cc/t/tccr1a-not-declared-in-this-scope/892894. We already changed cli() and sei() to noInterrupts() and interrupts(). Could anyone help us with changing this code into R4 suited code?
Thanks in advance.