Using a Dictionary from a custom Micropython library

แชร์
ฝัง
  • เผยแพร่เมื่อ 31 ธ.ค. 2024

ความคิดเห็น • 6

  • @keithlohmeyer
    @keithlohmeyer 6 หลายเดือนก่อน +1

    Nice job!. I wonder if your problems are IDE related. I have been wanting to ask which one you are using. I have never had that problem in Thonny. Another idea is I think microPython looks for library modules inside a "lib" folder. Thanks for the the video.

    • @VeryUsMumblings
      @VeryUsMumblings  6 หลายเดือนก่อน

      Could be the ide. I'm using Eric7 which is designed for python, not micropython. (the strange colours and theme problems are caused by me, screwing around with it ) the lib folder is there on the pico, but not on my laptop, so that might be something to check. Thanks for the comment! 👍

    • @keithlohmeyer
      @keithlohmeyer 6 หลายเดือนก่อน +1

      @@VeryUsMumblings I have found that import items need to be on the Pico to work.

    • @VeryUsMumblings
      @VeryUsMumblings  6 หลายเดือนก่อน

      @@keithlohmeyer Yeah, I was saving to my laptop first, then I started saving direct to the pico, but the changes weren't showing up when i ran the program, so I saved a new version and a new version again and again and that's how I got the seven versions of 'bone' program on the pico in the video. But I should probably find a better way than that. 😄

  • @charlotteswift
    @charlotteswift 6 หลายเดือนก่อน +1

    Hi Gabriel
    It's very annoying. I left a long helpful comment that has since disappeared. I try to remember a bit of what I said.
    You would make life easier for yourself if you put
    from CONTROLLER import idecontroller
    flash = idecontroller(15, 14, 13)
    That means that you can change the name of your library file just by changing the top line as opposed to searching through the program for references to it.
    I don't really get why you have the BONES. Surely the only library file should be called CONTROLLER.
    You should save CONTROLLER in /lib on the Pico. If you also have a copy on your PC, then it should be in a folder called 'libs' (for example) which wouldn't be normally accessible using the 'PATH' command and definitely not in the same place as the program that you're running. I think that your problems are probably being caused by the IDE not being designed for micropython/Pico which I don't think uses PATHS. It just expects a library file to be in /lib. My advice would be to use Thonny.
    I hope this comment doesn't get lost again.

    • @VeryUsMumblings
      @VeryUsMumblings  6 หลายเดือนก่อน

      Hi. My comments and homework posts seem to be disappearing, too. Thanks for all the helpful suggestions, but I've run through most of those before I made the video. The only reason for the BONE name was to use as test libraries before I used the final one. the BONEs and OONTROLLERs are all on the /lib folder on the pico, not my computer.
      You're right about the 'import ledcontroller from CONTROLLER thing. I'll know better for next time 😄 As far as switching to Thonny, I might have do that. Eric7 is for python, not micropython.
      Thanks for the nice comments. Here's hoping your posts don't disappear 👍