-6

Please someone can help me, because I do not found where is the mistake.

Please do not be mean with me I am just learning I only want to know How I solve this problem.

I have a mistake on this code because I put after each while and if a print, then, when I run the code only the first message is printed.

This is part of the code, I called the file 'test':

# -*- coding: utf-8 -*-
import serial
datosOEM=bytearray(5)
print(datosOEM)
datosOEM[0]=65
print(datosOEM)
x=[0]*6
...
k=0;
trama=1;
B=0;
C=0;
conexion=True;                 
if(conexion):
    #{
    print ('conexion ON')
    while(response<200):
        print ('data save')
        while(C==0):
            #{
            print ('what is C?')
            x[0]=datosOEM[k];
            if(x[0]==1):
                #{
                print ('what is x1?')
                x[1]=datosOEM[k+1];
                ...

When I run the file 'test.py', this is that I see

A
True
Port opened...
Data sent
inside while
"something" # This data change everytime that I run the code
conexion ON

To conclude I need your help with one thing: locate the mistake on the file 'test.py'

Please do not be rude with me I am just learning

###########################################################

In the form that I have the original post the viewers give me a -6

I just edit this post with a new name, PLEASE, I beg to the others viewers that vote "Like", because this page I am using to complete my thesis

1 Answers1

0
print ('conexion ON')
while(response<200):

response is a string ("something" in your debugging output). You are comparing it to an integer. In some implementations of Python, integers always compare "less than" strings, and it looks like that's why the loop is getting skipped in your case.

xxx
  • 1,153
  • 1
  • 11
  • 23
Jim Lewis
  • 43,505
  • 7
  • 82
  • 96