Hi Bernd,
Here is the code that is working with Arduino BSP:
/**
@file Sweep_simple.ino
**/
#include <Arduino.h>
#if defined NRF52_SERIES
#include <LoRaWan-RAK4630.h> //http://librarymanager/All#SX126x
#elif defined ARDUINO_ARCH_RP2040
#include <LoRaWan-Arduino.h>
#elif defined ESP32
#endif
#include <Servo.h>
#define STSPIN250_PH WB_IO4 //the PH pin determines the direction of the current
#define STSPIN250_PWM WB_IO3 //the PWM pin can be used to regulate the speed of the rotation
#define STSPIN250_FAULT_CHECK WB_IO5
#define STSPIN250_EN WB_IO6
Servo myservo; // create servo object to control a servo
int pos = 0; // variable to store the servo position
void setup()
{
Serial.begin(115200);
time_t timeout = millis();
while (!Serial)
{
if ((millis() - timeout) < 5000)
{
delay(100);
}
else
{
break;
}
}
Serial.println("RAK17001 Hbridege Test!");
pinMode(STSPIN250_PH, OUTPUT);
digitalWrite(STSPIN250_PH, HIGH);
pinMode(STSPIN250_PWM, OUTPUT);
digitalWrite(STSPIN250_PWM, LOW);
pinMode(STSPIN250_EN, OUTPUT);
digitalWrite(STSPIN250_EN, HIGH);//if set STSPIN250_EN High,sensor work normal.if set LOW, Sensors enter low power mode.
// digitalWrite(STSPIN250_EN, LOW);
myservo.attach(STSPIN250_PWM);
delay(500);
}
void loop()
{
for (pos = 0; pos <= 180; pos += 1) {
myservo.write(pos);
delay(15);
}
delay(1000);
for (pos = 180; pos >= 0; pos -= 1) {
myservo.write(pos);
delay(15);
}
delay(1000);
}
I’ve stripped the RAK17001_HBridge_STSPIN250.ino example to it’s minimum and added the Servo.h library, the libraries that are loaded are:
SX126x-Arduino 2.0.29 C:\Users\User\Documents\Arduino\libraries\SX126x-Arduino
SPI 1.0 C:\Users\ User\AppData\Local\Arduino15\packages\rakwireless\hardware\nrf52\1.3.3\libraries\SPI
Servo 1.1.2 C:\Users\ User\AppData\Local\Arduino15\packages\rakwireless\hardware\nrf52\1.3.3\libraries\Servo
Adafruit TinyUSB Library 1.7.0 C:\Users\User\AppData\Local\Arduino15\packages\rakwireless\hardware\nrf52\1.3.3\libraries\Adafruit_TinyUSB_Arduino
If I then change the board in VisualStudio to WisBlock Core RAK4631 and try to compile the same sketch the first error that appears is:
#error "SX126x-Arduino V2.0 does support all LoRaWAN regions without definition of 'REGION_XXYYY.
And the second is:
fatal error: Servo.h: No such file or directory
The first one is easy to overcome if I remove the #include <LoRaWan-RAK4630.h>. I’ve not been able to overcome the second error.
I’ve tried installing the Arduino Servo library, and I get the error:
C:\Users\User\Documents\Arduino\libraries\Servo\src\nrf52\Servo.cpp:31:24: error: 'NRF_PWM_CHANNEL_COUNT' was not declared in this scope
And many more errors that come after that one.
I’ve also tried with NRF52_ISR_Servo library. If I try to compile the NRF52_MultipleServos.ino sketch the error that appears is:
C:\Users\User\Documents\Arduino\libraries\NRF52_ISR_Servo\src/NRF52_ISR_Servo.hpp:50:10: fatal error: Adafruit_TinyUSB.h: No such file or directory
If I manually add the Adafruit_TinyUSB library into my libraries folder the error that appears is then:
C:\Users\User\Documents\Arduino\libraries\Adafruit_TinyUSB_Library\src/tusb_config.h:47:4: error: #error TinyUSB Arduino Library does not support your core yet
I have many sketches with boards running RUI3 so I’m confident that my environment is ok. Do you see anything that I’m doing wrong?