Can't connect to device when is running

  • I'm not sure if this is by design (I hope not) or if I'm running into a strange issue. I have a simple file that starts up a UART serial and connects my wipy to my home network, and that seems to work fine. I have a file that, once uploaded, seems to mostly work in terms of the buttons that it's supposed to interact with, but whenever is running, I cannot make any connections to the board via FTP, SSH, OR serial-over-USB. I overrided by pulling g28 to 3v3, connecting to FTP, and then deleting Now on restart I can connect again, but even if I try only to "Run" my script from atom/pymakr, I immediately lose the ability to connect to the device by any means.

    I can post my code if you think it'll help but wanted to check to see if this is known or if other people were having similar issues.

  • @ccarducci you could enable a for loop running every second, this way you can interrupt your program every second.

  • @ccarducci there are currently a few calls that are actually not interrupted by Ctrl-C, so you have to wait until that call has ended for it to take effect.

  • @dendeze

    It was interesting. At this point I'm assuming the issues are actually with the Pymakr plugin for Atom, and not the board itself. When I came back home I plugged the board back in and tried to reconnect. As I was renaming the file and getting ready to try to override and re-upload my newly named file, I decided to try once more to kill off from a connection. Despite the fact that the REPL prompt in atom/pymakr never showed that I actually connected, I think it was. At first ctrl+C wasn't working at all, but in my frustration I decided to just keep hitting it for a while, and after a few repeated keystrokes the board finally terminated Once I got that done, I was continuously able to replicate just by being patient and by repeatedly hitting ctrl+c after hitting the "Connect" button until it decided to take the keypress.

    After that I had to make a few tweaks to code where I was doing stupid things, and now it's all running smoothly. I'm going to stick mostly to putty/filezilla until the plugin feels a bit more 'baked' than it is.

  • @ccarducci looks like legit code. How is the renaming working out?

  • @dendeze
    Yes, sorry, the format of this forum is weirding me out. The way it was displayed it looked like I was responding to myself, not you, so I tried to delete and re-respond. I've re-posted now, not that I think it looks any better. also I can't post more than every 10 minutes because I'm a new user, which is really irritating when you're trying to actively reply in a thread. I also changed the formatting of my post to be three backticks instead of a four-space indent on each line, not that it makes much of a difference after it's already posted...

  • @dendeze
    I will post the code below.
    I used the correct IP address. The MAC for my Wipy is reserved on my router. I haven't changed the IP in filezilla or atom. I get ping responses even when I cannot connect, and the pings stop when I unpower the wipy. When I override and, I can connect to that same IP. My network is completely flat. I'm at x.x.x.110/24, the device is at x.x.x.115/24

    UART baud, for me, is set in at 115200.

    I can try to rename and execfile() when I get home.

    from machine import RTC
    import utime
    import pycom
    from machine import Pin
    def isDST(day, month, dow):
        DST Checker.
        This checks if the current day is DST
        # dow in this implementation is mon-sun, not sun-sat
        if dow == 6:
            dow = 0
            dow = dow + 1
        # January, february, and december are out.
        previousSunday = day - dow
        if (month < 3 or month > 11):
            return False
        # April to October are in
        elif (month > 3 and month < 11):
                return True
        # In march, we are DST if our previous sunday was on or after the 8th.
        elif (month == 3):
            return previousSunday >= 8
        # In november we must be before the first sunday to be dst.
        # That means the previous sunday must be before the 1st.
            return previousSunday <= 0
    def currentTime():
        # return a dict with all of the day selections?
        global cycleday
        curtime = utime.gmtime(utime.time())
        now = {"year":curtime[0], "month":curtime[1], "day":curtime[2], "hour":curtime[3],
        "minute":curtime[4], "second":curtime[5], "dow":curtime[6], "doy":curtime[7]}
        return now
    def setTimeZone():
        Time Zone Setter.
        This function sets the current time zone depending on the day and
        whether or not it's DST
        now = currentTime()
        if isDST(now["day"], now["month"], now["dow"]):
    def isNewDay():
        global cycleday, taken, logged
        now = currentTime()
        if (int(now["day"]) > int(cycleday)) or (cycleday == 100):
            cycleday = int(now["day"])
            logged = False
            taken = False
    def logButton():
        global logged
        logged = True
        # do something to log in Google drive or somewhere
    def pin_handler(arg):
        global taken
        taken = True
    def mainloop():
        The main loop of the program.
        Cycles through updating the LED if meds have been taken, as well as
        checking to make sure that the day hasn't changed. If the day has changed,
        then mainloop will change the LED back to red, and start the next day's
        global taken, logged
        if (taken == True) and (logged == False):
    dst = -14400
    est = -18000
    taken = False
    logged = False
    cycleday = 100
    p_in = Pin('P10', mode=Pin.IN, pull=Pin.PULL_UP)
    p_in.callback(Pin.IRQ_FALLING, pin_handler, arg=None)
    rtc = RTC()
    server = ""
    while True:

  • You just posted your code and removed it...

  • This post is deleted!

  • I would be happy to see your code,

    did you use the correct IP adres? Are you in a different subnet? Is your uart baud rate set in the you could alternatively try to rename your to and execute after uploading and connectiong true uart with:


Pycom on Twitter