Hi,
Just getting started with the Nano 33 BLE, and am seeing a strange compile error when I use digitalPinToPinName.
When I hard code using P1_12, it compiles just fine.
I have tried the mbed 2.1.0 board files as well as the deprecated version.
In the IDE 2.0 the digitalPinToPinName definition links to pinDefinitions.h and variant.cpp just fine.
I don't have the boards in yet, but that shouldn't affect the compile, right?
Any thoughts?
Code:
/*
Code to test PWM functionality
*/
#include "mbed.h"
#define MOTOR_PIN P1_12
#define MOTOR_PIN_NUM 3
//mbed::PwmOut motorPWM( MOTOR_PIN );
mbed::PwmOut motorPWM( digitalPinToPinName ( MOTOR_PIN_NUM ) );
void setup() {
// put your setup code here, to run once:
motorPWM.period(0.000125); // period = 125 us, freq = 8kHz
motorPWM.write(0.0);
}
void loop() {
// put your main code here, to run repeatedly:
for (float dutyCycle = 0; dutyCycle < 50; dutyCycle += 5) {
motorPWM.write( dutyCycle / 100.0 ); // duty cycle steps up 5% per second
delay( 1000 );
}
}
Error:
sketch\test_pwm.ino.cpp.o: In function
__static_initialization_and_destruction_0': C:\...\test_pwm/test_pwm.ino:11: undefined reference to
digitalPinToPinName(unsigned char)'
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino Nano 33 BLE.