It can be easily stolen with a spy camera:
Of course code can be difficult to defend against real "proficient" ...
But! This gives more safety:
-Arduino nano (or other)
-1 7 segment display (common cathod)
-1 74HC595 IC
-5 LED
-2 220-470 ohm resistors (or only one...)
-1 4,7 Kohm resistor
-2 buttons
-wires
Connects:
Arduino code (with 7 segment display):
int array[10] = {1,2,3,4,5,6,7,8,9,10} ;
int klick = -1;
int digit1a = 7;
int digit2a = 0;
int digit3a = 4;
int digit4a = 0;
int digit1b = 0;
int digit2b = 0;
int digit3b = 0;
int digit4b = 0;
int counter = 0;
int latchPin = 2; //Pin connected to ST_CP of 74HC595
int clockPin = 4; //Pin connected to SH_CP of 74HC595
int dataPin = 3; //Pin connected to DS of 74HC595
//for 74595
void setup(){
Serial.begin(9600);
// serial port optional, not need
pinMode(5, INPUT);
digitalWrite(5, HIGH);
pinMode(6, INPUT);
digitalWrite(6, HIGH);
//belso felhuzo
pinMode(7, OUTPUT);
digitalWrite(7, LOW);
// code in succeer green LED off
pinMode(8, OUTPUT);
digitalWrite(8, LOW);
// digit 1 LED
pinMode(9, OUTPUT);
digitalWrite(9, LOW);
// digit 2 LED
pinMode(10, OUTPUT);
digitalWrite(10, LOW);
// digit 3 LED
pinMode(11, OUTPUT);
digitalWrite(11, LOW);
// digit 4 LED
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
// for 74595
}
void loop(){
if (array[klick]-1 == 0) {
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, 63);
digitalWrite(latchPin, HIGH);
}
if (array[klick]-1 == 1) {
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, 6);
digitalWrite(latchPin, HIGH);
}
if (array[klick]-1 == 2) {
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, 91);
digitalWrite(latchPin, HIGH);
}
if (array[klick]-1 == 3) {
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, 79);
digitalWrite(latchPin, HIGH);
}
if (array[klick]-1 == 4) {
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, 102);
digitalWrite(latchPin, HIGH);
}
if (array[klick]-1 == 5) {
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, 109);
digitalWrite(latchPin, HIGH);
}
if (array[klick]-1 == 6) {
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, 125);
digitalWrite(latchPin, HIGH);
}
if (array[klick]-1 == 7) {
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, 7);
digitalWrite(latchPin, HIGH);
}
if (array[klick]-1 == 8) {
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, 127);
digitalWrite(latchPin, HIGH);
}
if (array[klick]-1 == 9) {
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, 111);
digitalWrite(latchPin, HIGH);
}
if (digitalRead(6) == LOW) {
delay (50);
if (digitalRead(6) == LOW) {
klick = klick + 1;
}
}
//push random button
if (klick == -1){
for (int i= 0; i< 10; i++)
{
int pos = random(10);
int t = array[i];
array[i] = array[pos];
array[pos] = t;
}
}
if (klick > -1 && klick < 10){
Serial.print(klick);
Serial.print(": ");
Serial.println(array[klick]-1);
}
// serial prnt optional, not need
if (klick > 10){
klick = -1;
}
// random part end
if (digitalRead(5) == LOW) {
delay (50);
if (digitalRead(5) == LOW) {
counter = counter + 1;
if (counter == 1){
digit1b = array[klick]-1;
digitalWrite(8, HIGH);
}
if (counter == 2){
digit2b = array[klick]-1;
digitalWrite(9, HIGH);
}
if (counter == 3){
digit3b = array[klick]-1;
digitalWrite(10, HIGH);
}
if (counter == 4){
digit4b = array[klick]-1;
digitalWrite(11, HIGH);
delay (2000);
}
}
}
// number in button
if (counter == 4) {
if (digit1b == digit1a && digit2b == digit2a && digit3b == digit3a && digit4b == digit4a) {
digitalWrite(7, HIGH);
delay(8000);
digitalWrite(7, LOW);
digitalWrite(8, LOW);
digitalWrite(9, LOW);
digitalWrite(10, LOW);
digitalWrite(11, LOW);
counter = 0;
klick = -1;
}else {
digitalWrite(8, LOW);
digitalWrite(9, LOW);
digitalWrite(10, LOW);
digitalWrite(11, LOW);
counter = 0;
klick = -1;
}
}
delay(150);
}
------------------------------------------------------
Further development:
Brightness change measurement hindrance...