Help me please with this

this is my coding

#include <ESP8266WiFi.h>
#include <CTBot.h>

#define P_BUTTON
#define LOCK

int b_cond = 0;

CTBot myTelebot;

String ssid = "#";
String password = "#";

String token = "#";
const int id = #;


void setup() {
 Serial.begin(9600);

 pinMode(P_BUTTON, INPUT_PULLUP);
 pinMode(LOCK, OUTPUT);

 myTelebot.wifiConnect (ssid,password);
 myTelebot.setTelegramToken(token);

 if(myTelebot.testConnection())
 {
  Serial.print("Connecting to");
  Serial.println(ssid);
  Serial.println("Connection Success.....");
  Serial.println();
 }

 else
  Serial.println("Connection Failed");
}

void loop() {
  b_cond = digitalRead(P_BUTTON);

  if(b_cond == HIGH){
    digitalWrite(LOCK,LOW);
    delay(3000);
    myTelebot.sendMessage(id, "YOUR CAGE IS OPEN");

  }else{
    digitalWrite(LOCK, HIGH);
  }

}

but when i run, i get error...
this is my error..

D:\project_juta2\project_juta2.ino: In function 'void setup()':
project_juta2:21:18: error: expected primary-expression before ',' token
   21 |  pinMode(P_BUTTON, INPUT_PULLUP);
      |                  ^
project_juta2:22:14: error: expected primary-expression before ',' token
   22 |  pinMode(LOCK, OUTPUT);
      |              ^
D:\project_juta2\project_juta2.ino: In function 'void loop()':
project_juta2:40:32: error: too few arguments to function 'int digitalRead(uint8_t)'
   40 |   b_cond = digitalRead(P_BUTTON);
      |                                ^
In file included from sketch\project_juta2.ino.cpp:1:
C:\Users\User\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Arduino.h:170:5: note: declared here
  170 | int digitalRead(uint8_t pin);
      |     ^~~~~~~~~~~
project_juta2:43:22: error: expected primary-expression before ',' token
   43 |     digitalWrite(LOCK,LOW);
      |                      ^
project_juta2:48:22: error: expected primary-expression before ',' token
   48 |     digitalWrite(LOCK, HIGH);
      |                      ^
exit status 1
expected primary-expression before ',' token

These are defined to be nothing, causing a subsequent syntax error.

They have to be something, they are telling the code where you input output stuff is connected, for example:

# define P_BUTTON 7    // pushbutton on pin 7

You may have other syntax errors.

HTH

a7

ok...i understand

Read the forum guidelines to see how to properly post code and some good information on making a good post.
Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.

You can go back and fix your original post by highlighting the code and clicking the </> in the menu bar.
code tags new

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.