Hello I am not able to send a binary signal like from python to Arduino

Hello I have a programming problem in which I cannot send a binary signal like 0, 1 for on/off. I don't know the command to do this and I have tried a lot of things. I want to send the signal from python to Arduino. I am trying to make a project in python in which I want to make a login screen kind of thing in which it asks you your name, age, hobby and password, if the password is right then then one led will blink but is the password is wrong nothing will happen and a message will print saying "Access Denied". Please someone help me I only have some time.

Might also be a wiring problem.

Carefully study the "How to get the best out of the forum" post, and add the required information to yours.

When is the school assignment due?

Help us help you. Is the problem in the Python code or the Arduino code or in the connection between the two?

How to do that probably depends on what type of machine is running the Python ?

Post a simple schematic or block diagram of what you are trying to do, preferably not a frizzy picture. How are they connected? What protocol are you using. What type of encoding are you trying. You say 0,1 is that "0","1" or 0x00, 0x01? Is this a school project?

Yes I am making a school project

The school assignment due date is not shared yet.

Here is the code:

String incomingByte ;    

void setup() {

  Serial.begin(9600);

  pinMode(7, OUTPUT);
  pinMode(6, OUTPUT);
  

}
void loop() {

  if (Serial.available() > 0) {

  incomingByte = Serial.readStringUntil('\n');

    if (incomingByte == "1") {

      digitalWrite(7, HIGH);
      digitalWrite(6, HIGH);

      Serial.write("Led on");

    }

    else if (incomingByte == "0") {

      digitalWrite(7, LOW);
      digitalWrite(6, LOW);

      Serial.write("Led off");

    }

This is for the Arduino IDE

What do you mean? I use VS code for python , If you are asking this?

The connection is not the problem. I do not know how to send a command that Arduino will recieve.
I tried using the 'print()' function but it just printed it in VS code. If this helps here is the code for python:
from operator import index

import webbrowser

import time

import serial

A = input("What is your name?")

B = input("What is you age?")

C = input("What do you do as a hobby?")

D = input("What is the passcode?")

print("What is your name: " + A)

print("What is your age: " + B)

print("What do you do as a hobby: " + C)

A = str(A)

B = str(B)

C = str(C)

serialcomm = serial.Serial('COM3', 9600)

while True:

serialcomm.timeout = 1

if D == "1289":

    print('1')

   

    print("access granted")

else:

    print('0', "Access denied.")

    break

serialcomm.write(D.encode())

time.sleep(0.5)

print(serialcomm.readline().decode('ascii'))

serialcomm.close()

How are Strings compared?

Why do we want to compare

What format is the data that you are sending ?
Is it ASCII data or is it binary data ?
Does the Arduino ever receive any data ?

Yes the Arduino recieves the data but there is not output. And the binary signal is like 0 = led off and
1= led on

And should I use this command to send a message(like 0,1) from python to Arduino?
serialcomm.write(b'1')
that was the command, Thanks.

Sorry, but I don't speak Python

how are things wired?

There is no wiring, led GND is connected to the GND of the Arduino And positive terminal of LED is connected to pin 6. The buzzer's GND terminal is connected to GND of the Arduino and Buzzer's positive terminal is connected to pin 7 of the Arduino. That's the only wiring

Its all good...

No current limiting resistor for the LED (nor buzzer)?

do you just have the PC connected to the arduino through USB? are you trying to open the serial monitor?