this code is breaking my sipy



  • this code is breaking my sipy

    from machine import UART

    uart=UART(1, baudrate=9600)

    uart.init(9600, bits=8, parity=None, stop=1)
    while(1):
    print(uart.readall())



  • gps...

    i kind of found part of the problem...

    the on the boot.py i had

    from machine import UART
    import os
    uart = UART(0, 115200)
    os.dupterm(uart)

    and on my main.py

    from machine import UART
    import time
    import pycom

    uart=UART(1, pins=("G2", "G1") )
    pycom.rgbled(0x000000)
    uart.init(9600, bits=8, parity=None, stop=1)
    while(1):
    print(uart.readall())
    time.sleep(1)

    maybe having uart on the boot and main.py files is conflicting... gonna change them



  • @iotmaker
    just curious
    what you have connected on uart1? GPS, phone...?



  • @livius said in this code is breaking my sipy:

    @iotmaker
    ok - then this must be something in pymakr
    but did you tried wifi AP+STA?
    you then can connect to router and in the same time connect to Wipy/LoPy

    thanks livius... yes thats the weird thing. it works with wifi, i can connect my laptop to the sipy wify and connect the pymakr without problem..

    i will see what else i can do..



  • @iotmaker
    ok - then this must be something in pymakr
    but did you tried wifi AP+STA?
    you then can connect to router and in the same time connect to Wipy/LoPy



  • @livius said in this code is breaking my sipy:

    @iotmaker
    i still do not understand you
    please back to previous post and look at my sample
    do you have it in boot.py?

    from machine import UART
    import os
    uart = UART(0, 115200)
    os.dupterm(uart)
    

    above duplicate rerminal on uart0 have you it in boot.py or not?

    without duplicate terminal you can not work on COM throught Pymakr

    Yes i have that code on the boot.py



  • @iotmaker
    i still do not understand you
    please back to previous post and look at my sample
    do you have it in boot.py?

    from machine import UART
    import os
    uart = UART(0, 115200)
    os.dupterm(uart)
    

    above duplicate rerminal on uart0 have you it in boot.py or not?

    without duplicate terminal you can not work on COM throught Pymakr



  • i just want to download and connect to the sipy via Serial or COM. but when i switch on the interface menu to use my COM port it cant connect. i dont like to connect to the sipy wifi everytime to download code.

    0_1486174609756_sipy.png



  • @iotmaker said in this code is breaking my sipy:

    but i think you cannot use the COM port to download programs if you are using a program that uses the comport to print to the screen

    I do not understand your answer
    But first, what are you trying to do? for what is your modification about uart1? You have some device on UART1? And UART/USB converter on UART0? Or what?

    Secondly you can use AP+STA mode of wifi.



  • @livius said in this code is breaking my sipy:

    @iotmaker

    what if you change it to

    while(1):
        print(uart.readall())
        machine.idle()
    

    I am not at home to try.

    but i think you cannot use the COM port to download programs if you are using a program that uses the comport to print to the screen

    i dont want to be switching my wifi connection every time i want to download something.



  • @iotmaker

    what if you change it to

    while(1):
        print(uart.readall())
        machine.idle()
    


  • @livius said in this code is breaking my sipy:

    @iotmaker
    What do you mean it work on putty? To work with pymakr you need duplicate terminal.
    What is your boot.py is it standard as:

    from machine import UART
    import os
    uart = UART(0, 115200)
    os.dupterm(uart)
    

    If answer is yes, then your code only print all data from UART1 as output on UART0

    yes thats what my code is doing. on the pymakr console i cannot see my prints. only on putty. ( i have putty closed when trying pymakr of course cant use the com port on two programs).

    after the program is running i cant connnect to the sipy and download programs via serial port. Is that normal?

    do i need to turn on the wireless everytime i want to download a program?.. .thanks



  • @iotmaker
    What do you mean it work on putty? To work with pymakr you need duplicate terminal.
    What is your boot.py is it standard as:

    from machine import UART
    import os
    uart = UART(0, 115200)
    os.dupterm(uart)
    

    If answer is yes, then your code only print all data from UART1 as output on UART0



  • the code is worky using putty and it does not work on the pymakr console...

    so are we supposed to download programs vi the wifi and then run the serial port on putty or what?



  • now i can only connect via wifi


Log in to reply
 

Pycom on Twitter