I recently started coding in the Arduino IDE for the Arduino Nano 33 BLE I bought. When I choose the Nano 33 BLE as my board, I get the following Error:
Arduino: 1.8.11 (Windows 10), Board: "Arduino Nano 33 BLE"
In file included from C:\Users\Niels\Documents\Arduino\libraries\LiquidCrystal\src\LiquidCrystal.cpp:1:0:
C:\Users\Niels\Documents\Arduino\libraries\LiquidCrystal\src\LiquidCrystal.h:45:36: error: expected class-name before '{' token
class LiquidCrystal : public Print {
^
C:\Users\Niels\Documents\Arduino\libraries\LiquidCrystal\src\LiquidCrystal.h:86:9: error: 'Print' has not been declared
using Print::write;
^~~~~
exit status 1
Error compiling for board Arduino Nano 33 BLE.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
I do not get this error when compiling for a normal Arduino nano board. This is my code:
#include <Arduino_LSM9DS1.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(12,11,5,4,3,2);
//pins:
const int measurePin = 13, calibratePin = 14, xHighPin = 15, xLowPin = 16, yHighPin = 17, yLowPin = 18;
//constants:
const int interval = 10;
const float delta = 10;
//variables:
boolean measureSts = LOW, calibrateSts = LOW, xyOK = true;
int count = 0, timer = 0;
float measurements[100], current, x, y, z, xZero, yZero, zZero;
//programm:
void setup() {
lcd.begin(16,2);
pinMode(measurePin, INPUT);
pinMode(calibratePin, INPUT);
pinMode(xHighPin, OUTPUT);
pinMode(xLowPin, OUTPUT);
pinMode(yHighPin, OUTPUT);
pinMode(yLowPin, OUTPUT);
}
void loop() {
if ( IMU.accelerationAvailable() ) {
IMU.readAcceleration(x, y, z);
calibrate();
checkXY();
measure();
current = z - zZero;
printValues();
}
else lcd.print("--geen sensor--");
}
void checkXY() {
xyOK = true;
if ( x < xZero - delta ) {
xyOK = false;
digitalWrite(xLowPin, HIGH);
digitalWrite(xHighPin, LOW);
}
else if ( x > xZero + delta ) {
xyOK = false;
digitalWrite(xLowPin, LOW);
digitalWrite(xHighPin, HIGH);
}
if ( y < yZero - delta ) {
xyOK = false;
digitalWrite(yLowPin, HIGH);
digitalWrite(yHighPin, LOW);
}
else if ( y > yZero + delta ) {
xyOK = false;
digitalWrite(yLowPin, LOW);
digitalWrite(yHighPin, HIGH);
}
}
void measure(){
if ( digitalRead(measurePin) == LOW && measureSts == HIGH && xyOK ) {
measurements[count] = z - zZero;
zZero = z;
timer = interval;
count++;
}
measureSts = digitalRead(measurePin);
}
void printValues() {
if ( timer >= interval ) {
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Meting: " + String(measurements[count]) + (char)223);
lcd.setCursor(0,1);
lcd.print("Huidig: " + String(current) + (char)223);
timer = 0;
}
timer++;
}
void calibrate() {
if ( digitalRead(calibratePin) == LOW && calibrateSts == true ) {
xZero = x;
yZero = y;
lcd.setCursor(0,3);
lcd.print("kalibreren");
lcd.setCursor(1,4);
lcd.print("voltooid");
digitalWrite(xHighPin, HIGH);
digitalWrite(xLowPin, HIGH);
digitalWrite(yHighPin, HIGH);
digitalWrite(yLowPin, HIGH);
delay(100);
lcd.clear();
digitalWrite(xHighPin, LOW);
digitalWrite(xLowPin, LOW);
digitalWrite(yHighPin, LOW);
digitalWrite(yLowPin, LOW);
}
calibrateSts = digitalRead(calibratePin);
}
For context: I am trying to create an angle-measuring device using the built-in accelerometer and a 2x16 LCD.
I hope someone can help me fixing this. Thanks in advance.
-Niels