2

I'm having an irritating situation with my Arduino Uno wifi rev2 board. I made an installation with an LCD, keypad and little servo motor. I first wrote the code for my regular Arduino Uno and everything worked fine. Now I migrated my installation to my new Arduino Uno wifi rev2 because I needed it to make a request. But the problem is when I try to upload my code to the wifi rev2 it gives me a compilation error. I tried to upload a blink test sketch to see if it would work and it did but somehow it doesn't want to compile this code:

#include <Wire.h>

#include <LiquidCrystal_I2C.h>
#include <Servo.h>
#include <Keypad.h>

LiquidCrystal_I2C lcd(0x27,16, 2);
Servo myservo;
const byte ROWS = 4; 
const byte COLS = 3; 

char hexaKeys[ROWS][COLS] = {
  {'1', '2', '3'},
  {'4', '5', '6'},
  {'7', '8', '9'},
  {'*', '0', '#'}
};

byte rowPins[ROWS] = {3, 4, 5, 6}; 
byte colPins[COLS] = {9, 8, 7}; 

Keypad customKeypad = Keypad(makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS); 
String value = "";

void setup(){
  lcd.begin();
  Serial.begin(9600);
  myservo.attach(A0);
 lcd.backlight();
 //myservo.write(0);

}


void loop(){
    lcd.clear();
    char customKey = customKeypad.getKey();   // get the key pressed
    value = value + String(customKey);
    lcd.print("Geef bestelcode");
     lcd.setCursor(0,1);
    lcd.print("in: " + value);
 // char customKey = customKeypad.getKey();   // get the key pressed
 if(customKey=='#'){       
        if(value == "1234#"){
          myservo.write(0);
          }
     // int pos = value.toInt();             // convert value to int
     // myservo.write(pos);                 // rotate the servo
         else{exit;}                   // clear the string
    }

     if(customKey=='*'){                       // 'D' works as "enter"
      myservo.write(90);                   // rotate the servo
      value = "";                           // clear the string
    }


 /*
  if(customKey && customKey!= '#'){         // if the key pressed is not 'D'
      value = value + String(customKey);    // concatenate the number to value
      //Serial.println(value);
  }*/
   delay(175);
}

The output of my error console :

In file included from C:\Users\TONES-PC\Documents\Arduino\sketch_dec15a_parcelbox_tester\sketch_dec15a_parcelbox_tester.ino:5:0:

C:\Users\TONES-PC\Documents\Arduino\libraries\Keypad/Keypad.h: In member function 'virtual void Keypad::pin_write(byte, boolean)':

C:\Users\TONES-PC\Documents\Arduino\libraries\Keypad/Keypad.h:88:81: error: cannot convert 'boolean {aka bool}' to 'PinStatus' for argument '2' to 'void digitalWrite(pin_size_t, PinStatus)'

  virtual void pin_write(byte pinNum, boolean level) { digitalWrite(pinNum, level); }

                                                                                 ^

Several libraries found for "Wire.h"
used: C:\Users\TONES-PC\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.5\libraries\Wire
Several libraries found for "LiquidCrystal_I2C.h"
used: C:\Users\TONES-PC\Documents\Arduino\libraries\Arduino-LiquidCrystal-I2C-library-master
Several libraries found for "Servo.h"
used: C:\Program
Several libraries found for "Keypad.h"
used: C:\Users\TONES-PC\Documents\Arduino\libraries\Keypad
exit status 1
Error with compiling for board Arduino Uno WiFi Rev2

Any thoughts on how to solve this?

imkeVr
  • 161
  • 4

0 Answers0