THE ANNIN ROBOTICS FORUM HAS MOVED TO A NEW COMMUNITY. 👉
python3 If Input On...
 
Notifications
Clear all

python3 If Input On Jump to Tab

2 Posts
1 Users
0 Reactions
42 Views
Avatar of Kanatmetin
(@kanatmetin)
Active Member
Joined: 2 months ago
Posts: 8
Topic starter  

Have you been running the go to tab command if the entry is open I am having a problem here with the verdict I was investigating in python3

 

ser.write (command.encode ())

    ser.flushınput ()

    time.sleep (.2)

    value = ser.readline ()

    if (value == b'T '):

 

ascii problem in this section



   
Quote
Avatar of Kanatmetin
(@kanatmetin)
Active Member
Joined: 2 months ago
Posts: 8
Topic starter  

I reached the result with an arrangement like this.

 

code on the arduino side

 

//-----COMMAND IF INPUT THEN JUMP---------------------------------------------------

//-----------------------------------------------------------------------

if (function == "JF")

{

int IJstart = inData.indexOf('X');

int IJTabstart = inData.indexOf('T');

int IJInputNum = inData.substring(IJstart + 1, IJTabstart).toInt();

if (digitalRead(IJInputNum) == HIGH)

{

Serial.println("True\n");

}

if (digitalRead(IJInputNum) == LOW)

{

Serial.println("False\n");

}

}

 

Change

 

python side code

 

if (cmdType == "If On "):

inputIndex = command.find("Input-")

tabIndex = command.find("Tab-")

inputNum = str(command[inputIndex+6:tabIndex-9])

tabNum = str(command[tabIndex+4:])

command = "JFX"+inputNum+"T"+tabNum+"\n"

ser.write(command.encode())

ser.flushInput()

time.sleep(.2)

value = ser.readline()

if (value == b'True\n'):

index = tab1.progView.get(0, "end").index("Tab Number " + tabNum)

index = index-1

tab1.progView.selection_clear(0, END)

tab1.progView.select_set(index)

 
 

replace with the problem will be fixed

 

I solved the problem this way. I don't know how true. but the problem has improved.

 

1

 
 
 


   
ReplyQuote
Share:
Upload your Photo