Weird wemos D1 R1

I'm building a door locking system with arduino, using Uno everything works fine, no code problems, the point is that I would like to move the project to a new wemos D1 R1 because of WiFi, I made the necessary adjustments to the code, The problem is that: When I set the password, the board was supposed to send a signal to a servo, but it just doesn't do that!
the code is from this link here: Arduino - Simulando fechadura controlada por senha - BLOG MASTERWALKER SHOP (removed the leds)
I have already ruled out any problem with the board, I bought two identical boards that have the same behavior, hence the question:
is there any maximum limit of items that can be linked to this Wemos D1 R1? It has 11 digital ports, I could use 11, no? I'm currently trying to use 9 simultaneous (8 for the matrix keyboard, 1 for the servo signal) and I intend to use one more to add a button to the project, is it possible?

Thanks in advance!!

@monteir00
You appear to have posted the same question twice, once in English, once in Portuguese. It is against the forum rules to post the same question multiple times because it wastes the time of the people trying to help you.

Which version do you want to keep?

You have also posted in installation and troubleshooting, from reading your question I can't see what this has to do with installation or troubleshooting as described here About the Installation & Troubleshooting category

Please read How to get the best out of this forum

But, we can't see those... how can we understand any problem with it?

sorry

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

Servo servo_Motor; 
char* password = "123"; 
int position = 0;
const byte ROWS = 4; 
const byte COLS = 4; 
char keys[ROWS][COLS] = {
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};

byte rowPins[ROWS] = { D0, D1, D2, D3 }; 
byte colPins[COLS] = { D4, D5, D6, D7 }; 

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

void setup(){
  servo_Motor.attach(D8); 
  servo_Motor.write(0); 

void loop(){
  char key = keypad.getKey(); 
  if (key == '*' || key == '#') { 

      position = 0; 
      servo_Motor.write(0); 
}
if (key == password[position]){ 
      position ++;

if (position == 3){ 
     servo_Motor.write(82);
}
delay(100);
}

See how it was mangled by the forum? Please go back and edit it to put the code in code tags. It would also help you to use ctrl-T in the IDE first, to properly indent the code.

By the way, have you tested the servo part by itself, without any keypad code? Just to make sure it works?

@monteir00
Other topic closed as requested.

I have moved this to programming questions. Please take more care where you post in future.

Thank you.

I'll edit it when arrive home, thx for the advice, about the servo yes its perfectly working, the matrix keyboard too, in other projects the boards work and in this project the only board working is UNO, I don't have any ideas about what can be... what do you think?

I think maybe you didn't fully understand. I'm not asking if those components worked in other projects. I'm asking if you've tested them with the current project as it is assembled now.

Hi
The best way to find a problem is to simplify the area where the error occurs.
For example: Simplify , use in your Wemos sketches that only move your servo, first use a sketch that makes your servo move to 90°, then use another one that makes it move to -90° and then to 90°.
If it works like this, tell us.
If not, then post your assembly schematic for this test,
including the servo power supply and the servo connections.

Ah, don't forget to tag your posted sketch.
ArduinoForum

RV mineirin

Thanks for the tip @ruilviana , so i did the test with the servo now, i think it's working fine... i connected it to D3, GND and 5v on the wemos, it make the movement like a "windshield wiper" if you understand me, following is the code i used


#include <Servo.h> 

int servoPin = D3; 

Servo Servo1; 
void setup() { 
   Servo1.attach(servoPin); 
}
void loop(){ 
   Servo1.write(-90); 
   delay(1000);  
   Servo1.write(90); 
   delay(1000); 
}

@aarg im sorry, if i understand the question now the answer is: i tried to make it run all assembled together like it's described in the code and nothing happened, the board leds blink like crazy, principally the one in wifi module, but nothing besides that.

I think is a good information: i conected leds to all the digital pins in the wemos board, and two of them (D0 and D8) doesnt turn off only when i order it to blink and the digital pins between D11 and D15 replicated the commands i gave to the pins between D3 and D7 (as expected).

With that information I did a little modification in the code and into the installation, i avoided all these pins (D0, D8 and D11 to D15) the code is like this now:

#include <Keypad.h> // BIBLIOTECA PARA O FUNCIONAMENTO DO TECLADO DE MEMBRANA
#include <Servo.h> // BIBLIOTECA PARA O FUNCIONAMENTO DO SERVO

Servo servo_Motor; //OBJETO DO TIPO SERVO
char* password = "123"; //SENHA CORRETA PARA DESTRANCAR A FECHADURA
int position = 0; //VARIÁVEL PARA LEITURA DE POSIÇÃO DA TECLA PRESSIONADA
const byte ROWS = 4; //NUMERO DE LINHAS DO TECLADO
const byte COLS = 4; //NUMERO DE COLUNAS DO TECLADO
char keys[ROWS][COLS] = { //DECLARAÇÃO DOS NUMEROS, LETRAS E CARACTERES DO TECLADO
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};

byte rowPins[ROWS] = { D1, D2, D3, D4 }; // PINOS DE CONEXAO DAS LINHAS DO TECLADO
byte colPins[COLS] = { D5, D6, D7, D9 }; //PINOS DE CONEXAO DAS COLUNAS DO TECLADO
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );//AS VARIAVEIS rowPins E colPins RECEBERÃO O VALOR DE LEITURA DOS PINOS DAS LINHAS E COLUNAS RESPECTIVAMENTE


void setup(){
  servo_Motor.attach(D10); //PINO DE CONTROLE DO SERVO MOTOR
  servo_Motor.write(0); //POSIÇÃO DO SERVO FICA EM 0º (FECHADURA TRANCADA)
}

void loop(){
  char key = keypad.getKey(); //LEITURA DAS TECLAS PRESSIONADAS 
  if (key == '*' || key == '#') { //SE A TECLA PRESSIONADA POR IGUAL A CARACTERE "*" OU "#", FAZ
      position = 0; //POSIÇÃO DE LEITURA DA TECLA PRESSIONADA INICIA EM 0
      servo_Motor.write(0); //POSIÇÃO DO SERVO FICA EM 0º (FECHADURA TRANCADA)
}
if (key == password[position]){ //SE A TECLA PRESSIONADA CORRESPONDER A SEQUÊNCIA DA SENHA, FAZ
      position ++;//PULA PARA A PRÓXIMA POSIÇÃO
}
if (position == 3){ // SE VARIÁVEL FOR IGUAL A 3 FAZ (QUANDO AS TECLAS PRESSIONADAS CHEGAREM A 3 POSIÇÕES, SIGNIFICA QUE A SENHA ESTÁ CORRETA)
     servo_Motor.write(82);// SERVO GIRA A 82º (FECHADURA DESTRANCADA)
}
delay(100);//INTERVALO DE 100 MILISSEGUNDOS
}

(please, ignore the comments)

But what i was waiting to happen just didn't  :( 

any ideas?

What is the status of the project now? You didn't say if it works or not, or the results of your changes...

@anon57585045 not working :frowning:

Did you test everything separately, as was suggested by several people?

yes

...and ???

as i said, together they aren't working :frowning:

Hi
Does your Wemos R1 D1 have this pinout?

RV mineirin

1 Like

That is not a complete answer. Are they all working separately?

Yesss is this one exactly!