Hi, thanks for your reply!
Absolutely. The code is as follows:
#include <U8g2lib.h>
#include <U8x8lib.h>
#include <SPI.h>
#include <MFRC522.h>
U8G2_SSD1306_128X64_NONAME_1_SW_I2C(U8G2_R0, a5, a4);
#define SS_PIN 10
#define RST_PIN
MFRC522 mfrc522(SS_PIN, RST_PIN); // MFRC522 instance.
int frame = 0;
int LED = 8;
const uint8_t frame1 [] PROGMEM = {
BITMAP 1 CODE
};
const uint8_t frame2[] PROGMEM = {
BITMAP 2 CODE.
};
void setup(void) {
u8g2.begin();
Serial.begin(9600); // Initiate a serial communication
SPI.begin(); // Initiate SPI bus
mfrc522.PCD_Init(); // Initiate MFRC522
Serial.println("Welcome to OMNID");
pinMode (LED,OUTPUT);
present();
}
void loop(void) {
if ( ! mfrc522.PICC_IsNewCardPresent())
{
return;
}
// Select one of the cards
if ( ! mfrc522.PICC_ReadCardSerial())
{
return;
}
//Show UID on serial monitor
Serial.print("UID tag :");
String content= "";
byte letter;
for (byte i = 0; i < mfrc522.uid.size; i++)
{
Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ");
Serial.print(mfrc522.uid.uidByte[i], HEX);
content.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "));
content.concat(String(mfrc522.uid.uidByte[i], HEX));
}
Serial.println();
Serial.print("Message : ");
content.toUpperCase();
if (content.substring(1) == "D1 34 47 D5")//change here the UID of the card/cards that you want to give access
{
digitalWrite(LED, HIGH);
Serial.println("X");
u8g2.firstPage();
do {
u8g2.clearBuffer();
drawBitmap(0, 0, 16, 64, const uint8_t frame1);
u8g2.sendBuffer();
delay(4000);
} while ( u8g2.nextPage() );
digitalWrite(LED, LOW);
// delay(10000);
present();
}
if (content.substring(1) == "A5 B1 03 6D")//change here the UID of the card/cards that you want to give access
{
digitalWrite(LED, HIGH);
Serial.println("Y");
u8g2.firstPage();
do {
u8g2.clearBuffer();
drawBitmap(0, 0, 16, 64, const uint8_t frame2);
u8g2.sendBuffer();
delay(4000);
} while ( u8g2.nextPage() );
digitalWrite(LED, LOW);
// delay(10000);
present();
}
}
void present(){
// Clear the buffer.
u8g2.clearBuffer();
u8g2.firstPage();
u8g2.setFont(u8g_font_04b_03b);
u8g2.setPrintPos(20, 20);
u8g2.print("PRESENT OMNID");
}
The errors are as follows:
Project_Y:6: error: expected ')' before ',' token
U8G2_SSD1306_128X64_NONAME_1_SW_I2C(U8G2_R0, a5, a4);
^
Project_Y:6: error: no matching function for call to 'U8G2_SSD1306_128X64_NONAME_1_SW_I2C::U8G2_SSD1306_128X64_NONAME_1_SW_I2C()'
U8G2_SSD1306_128X64_NONAME_1_SW_I2C(U8G2_R0, a5, a4);
^
/Users/christofferjensen/Documents/Arduino/Project_Y/Project_Y.ino:6:46: note: candidates are:
In file included from /Users/christofferjensen/Documents/Arduino/Project_Y/Project_Y.ino:1:0:
/Users/christofferjensen/Documents/Arduino/libraries/U8g2-2.8.5/src/U8g2lib.h:400:11: note: U8G2_SSD1306_128X64_NONAME_1_SW_I2C::U8G2_SSD1306_128X64_NONAME_1_SW_I2C(const u8g2_cb_t*, uint8_t, uint8_t, uint8_t)
public: U8G2_SSD1306_128X64_NONAME_1_SW_I2C(const u8g2_cb_t *rotation, uint8_t clock, uint8_t data, uint8_t reset = U8X8_PIN_NONE) : U8G2() {
^
/Users/christofferjensen/Documents/Arduino/libraries/U8g2-2.8.5/src/U8g2lib.h:400:11: note: candidate expects 4 arguments, 0 provided
/Users/christofferjensen/Documents/Arduino/libraries/U8g2-2.8.5/src/U8g2lib.h:399:7: note: constexpr U8G2_SSD1306_128X64_NONAME_1_SW_I2C::U8G2_SSD1306_128X64_NONAME_1_SW_I2C(const U8G2_SSD1306_128X64_NONAME_1_SW_I2C&)
class U8G2_SSD1306_128X64_NONAME_1_SW_I2C : public U8G2 {
^
/Users/christofferjensen/Documents/Arduino/libraries/U8g2-2.8.5/src/U8g2lib.h:399:7: note: candidate expects 1 argument, 0 provided
/Users/christofferjensen/Documents/Arduino/libraries/U8g2-2.8.5/src/U8g2lib.h:399:7: note: constexpr U8G2_SSD1306_128X64_NONAME_1_SW_I2C::U8G2_SSD1306_128X64_NONAME_1_SW_I2C(U8G2_SSD1306_128X64_NONAME_1_SW_I2C&&)
/Users/christofferjensen/Documents/Arduino/libraries/U8g2-2.8.5/src/U8g2lib.h:399:7: note: candidate expects 1 argument, 0 provided
Project_Y:6: error: expected initializer before ')' token
U8G2_SSD1306_128X64_NONAME_1_SW_I2C(U8G2_R0, a5, a4);
^
Project_Y:11: error: expected primary-expression before ')' token
MFRC522 mfrc522(SS_PIN, RST_PIN); // MFRC522 instance.
^
/Users/christofferjensen/Documents/Arduino/Project_Y/Project_Y.ino: In function 'void setup()':
Project_Y:149: error: 'u8g2' was not declared in this scope
u8g2.begin();
^
/Users/christofferjensen/Documents/Arduino/Project_Y/Project_Y.ino: In function 'void loop()':
Project_Y:191: error: 'u8g2' was not declared in this scope
u8g2.firstPage();
^
Project_Y:194: error: expected primary-expression before 'const'
drawBitmap(0, 0, 16, 64, const uint8_t frame1);
^
Project_Y:194: error: 'drawBitmap' was not declared in this scope
drawBitmap(0, 0, 16, 64, const uint8_t frame1);
^
Project_Y:206: error: 'u8g2' was not declared in this scope
u8g2.firstPage();
^
Project_Y:209: error: expected primary-expression before 'const'
drawBitmap(0, 0, 16, 64, const uint8_t frame2);
^
Project_Y:209: error: 'drawBitmap' was not declared in this scope
drawBitmap(0, 0, 16, 64, const uint8_t frame2);
^
/Users/christofferjensen/Documents/Arduino/Project_Y/Project_Y.ino: In function 'void present()':
Project_Y:221: error: 'u8g2' was not declared in this scope
u8g2.clearBuffer();
^
Project_Y:223: error: 'u8g_font_04b_03b' was not declared in this scope
u8g2.setFont(u8g_font_04b_03b);
^
exit status 1
expected ')' before ',' token
Thanks!