Hello, i have this error:
Arduino: 1.8.10 (Windows 10), Board:"Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"
sketch_may24a:89:1: error: expected unqualified-id before '{' token
{
^
Meerdere bibliotheken gevonden voor "Password.h"
Gebruikt: C:\Users\depre\OneDrive\Documenten\Arduino\libraries\Password
Meerdere bibliotheken gevonden voor "Keypad.h"
Gebruikt: C:\Users\depre\OneDrive\Documenten\Arduino\libraries\Keypad
Meerdere bibliotheken gevonden voor "SPI.h"
Gebruikt: C:\Users\depre\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.2\libraries\SPI
Meerdere bibliotheken gevonden voor "RFID.h"
Gebruikt: C:\Users\depre\OneDrive\Documenten\Arduino\libraries\Firmware
Meerdere bibliotheken gevonden voor "Servo.h"
Gebruikt: C:\Program
exit status 1
expected unqualified-id before '{' token
Dit rapport zou meer informatie bevatten met
"Uitgebreide uitvoer weergeven tijden compilatie"
optie aan in Bestand -> Voorkeuren.
#include <SPI.h>
#include <RFID.h>
#include <Servo.h>
#define SDA_DIO 12
#define RESET_DIO 11
RFID RC522(SDA_DIO, RESET_DIO);
int servoPin = 13;
int test = 0;
Servo Servo1;
#include <Password.h> //http://www.arduino.cc/playground/uploads/Code/Password.zip
#include <Keypad.h> //http://www.arduino.cc/playground/uploads/Code/Keypad.zip
Password password = Password( "1234" );
const byte ROWS = 4; // Four rows
const byte COLS = 4; // columns
// Define the Keymap
char keys[ROWS][COLS] = {
{'1', '2', '3', 'A'},
{'4', '5', '6', 'B'},
{'7', '8', '9', 'C'},
{'*', '0', '#', 'D'}
};
byte rowPins[ROWS] = { 9, 8, 7, 6 }; // Connect keypad ROW0, ROW1, ROW2 and ROW3 to these Arduino pins.
byte colPins[COLS] = { 5, 4, 3, 2, }; // Connect keypad COL0, COL1 and COL2 to these Arduino pins.
// Create the Keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
void setup()
{
delay(100);
Serial.begin(9600);
// keypad.addEventListener(keypadEvent);
/* Enable the SPI interface */
SPI.begin();
/* Initialise the RFID reader */
RC522.init();
Servo1.write(0);
Servo1.attach(servoPin);
}
void loop()
{
if (RC522.isCard())
{
RC522.readCardSerial();
//Serial.println("Card detected:");
for (int i = 0; i < 5; i++)
{
//Serial.print(RC522.serNum[i],DEC);
test = 1;
}
//Serial.println();
//Serial.println();
if (test == 1)
{
Servo1.write(180);
}
//delay(1000);
}
}
{
keypad.getKey();
}
//take care of some special events
void keypadEvent(KeypadEvent eKey) {
switch (keypad.getState()) {
case PRESSED:
Serial.print("Pressed: ");
Serial.println(eKey);
switch (eKey) {
case '*': checkPassword(); break;
case '#': password.reset(); break;
default: password.append(eKey);
}
}
}
void checkPassword() {
if (password.evaluate()) {
Serial.println("Success");
//Add code to run if it works
} else {
Serial.println("Wrong");
//add code to run if it did not work
}
}