yeah actually let me clarify the thing here
I am applying this on for a digital lock code like this
const byte Trig1 = 22;
const byte Led1 = 7;
const byte Led2 = 8;
const byte Led3 = 9;
const byte Led4 = 10;
signed long count = 1;
const byte led0 ;
signed long LEDpins[] = {led0, Led1, Led2, Led3, Led4};
signed long dots[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
void setup() {
Serial.begin(9600);
pinMode(Trig1, INPUT_PULLUP);
pinMode(Led1, OUTPUT);
pinMode(Led2, OUTPUT);
pinMode(Led3, OUTPUT);
pinMode(Led4, OUTPUT);
}
void loop() {
// Pro(1, Trig1, &LEDpins[1]); // Not Working
Pro(&dots[1], Trig1, &LEDpins[3]); // Working
}
void Pro(signed long * dotter, const byte * TRIGs, signed long * myPins)
{
if(count == * dotter)
{
if(!digitalRead(TRIGs))
{
digitalWrite(* myPins, HIGH);
while(!digitalRead(TRIGs));
}
else
{
digitalWrite(* myPins,LOW);
}
}
}
Now in this above code you can check it out as mentioned
We have here
// Pro(1, Trig1, &LEDpins[1]); // Not Working
Pro(&dots[1], Trig1, &LEDpins[3]); // Working
within the void loop
The reason for the ARRAY thing is due to the proper working of this line
Pro(&dots[1], Trig1, &LEDpins[3]);
While this line with a simple numeric entry is not working any way
Pro(1, Trig1, &LEDpins[1]);
Actually the working is like :-
For this secret lock a numeric value between 1 to 400 ll be provided to the user
and that numeric value would be placed in the code in a simple way as '1' or anything
like that OR the value would be placed inside the bracket of "&dots[1]".
Weekly or daily the numeric ll be placed and ll be allotted to the User.
That is the aim actually
There could be multiple such set of locks for a combination to open the gate
so here in the code I applied the void argument to make the script short and I am facing problem with this count value
Please guide !!!