Welcome to EnviroDIY, a community for do-it-yourself environmental science and monitoring. EnviroDIY is part of WikiWatershed, an initiative of Stroud Water Research Center designed to help people advance knowledge and stewardship of fresh water.
New to EnviroDIY? Start here

Sedhead

Forum Replies Created

Viewing 10 posts - 1 through 10 (of 14 total)
  • Author
    Posts
  • Sedhead
    Participant

      I think that the directory structure could be the culprit. The way that I have been able to reliably get this work is the following:

      1. Create a new Platformio project.
      2. Create an identically-named folder in that project in which to put my code.
      3. Create an identically-named .ino file in that folder for the sketch I need to upload.
      4. Use the Compare files functionality in VSC to move all of my old code into those new files.
      5. Compile and upload

      So I’m basically re-making the project in platformio and that seems to work.

      Sedhead
      Participant

        I think I agree with you about the complexity of deploying multiple sensor packages, each with different UUIDs. However, I don’t think that is what’s screwing me up here. As of now, I simply can’t get my sketches to reliably upload to the boards. I honestly don’t think that the compile and upload process is even getting to a place in my code where UUIDs are even called. Something is compiling and uploading, but it’s only a fraction of the size of my code and it does nothing. When I first coded it, no problem. Now, only problems. So my fear is that I will deploy these sensors, then in a couple of weeks I will need to update the code (I need to acquire a couple week’s worth of data to find the max sonar distance) and I won’t be able to do it in place because the code won’t upload. The really frustrating part of this is the fact that no single “fix” has worked. Something works once, then not again.

        Sedhead
        Participant

          Alright, I have no idea if this will help or not, but I think it’s important that I get this down for completeness.

          1. If I open the public repo that I shared above in VSC from Github Desktop, then copy the sketch into it that I need to load, it seems to compile and upload. So, as of right now, I have my sketches loaded onto my boards and they are cranking away.
          2. However, I don’t want to share my passwords and such in a public repo. So, I duplicated the public repo above following the guidelines here. When I open that repo and try to compile or upload the very same sketches in the duplicate, private repo, I get the same problem of them not compiling and uploading, as above.

          I tried going back in time on Platformio to see if the new version of it was causing this problem, but that’s not it. There seems to be something going on between VSC and Github. Changing the private repo to public doesn’t change the bad behavior.

          Sedhead
          Participant

            <h1>Partially solved!</h1>
            I may have found part of the problem, thanks to you. I had to create a new repo in order to share my code with you. When I open that new repo in VSC from Github desktop it compiles as you’ve described. I was starting to have a hunch that the problem was that I had branched from main to add some additional functionality and I thought that I could just upload from that branch. However, the branched code doesn’t compile or upload as described above. When I revert to main on Github desktop and open the code, it compiles and uploads just fine. You learn something new every day (or week or month, in my case).

            So, this worked for one of the sketches. But when I tried this on a second sketch that uses a different Mayfly, I get the old behavior. I’ll keep trying!

            Sedhead
            Participant

              That definitely sounds more like what should be happening! Thanks so much for taking the time to do this, Neil. I will try to fix things on Monday when I’m back in my office and next to my sensors.

              Just a funny addendum. I just created a ChapGPT account so that I could stay abreast of it in my teaching. Here is the text of my first chat:

              Why won’t my sketch upload to my mayfly datalogger?
              ChatGPT

              Hey Tom! It sounds like you’re having trouble uploading your sketch to your Mayfly datalogger. There could be a few reasons for this. First, make sure you have the correct USB drivers installed for the Mayfly and that your computer recognizes it. Also, double-check your connections and ensure the datalogger is powered on.

              Sometimes, issues arise due to conflicts in the sketch or with other software running on your computer. Try restarting both your computer and the datalogger, and then attempt the upload again. If the problem persists, you might want to check the Arduino IDE for any error messages that could provide more insight into what’s going wrong.

              If you’re using any additional libraries in your sketch, ensure they are properly installed and compatible with your Mayfly version. Keep an eye out for any specific instructions or troubleshooting steps provided by the Mayfly community or manufacturer.

              Remember, technology can be a bit finicky sometimes, but with a bit of troubleshooting, you should be able to get your sketch uploaded successfully. If you’re still having issues, don’t hesitate to reach out to fellow Mayfly users or the manufacturer’s support for more personalized assistance. Good luck, and I hope you get your datalogger up and running soon!

              As for your question about my data sources, I’ve been trained on a diverse range of texts from the internet, books, articles, and other sources to provide information and generate responses. My responses are based on patterns in the data I’ve been exposed to, but I don’t have real-time access to the internet or specific external databases.

              Sedhead
              Participant

                Here’s a link to a new public repo: https://github.com/tahickson/UST_Earth_Envt_Society

                The platformio.ini file should have all you need to know in it. Should be ready to go. Thanks for giving this a try!

                Sedhead
                Participant

                  I really want to thank you for giving me help and feedback on this. Although I can’t, for the life of me, understand what’s going on, at least someone is throwing out ideas. My code is under git/source control. I cannot see any changes that I’ve made, looking over my Github history, that could explain this. I did branch off of main to work on some other bells and whistles, but never got around to them. It just stopped compiling and loading properly I tried your cut and paste suggestion, but got the same results. I guess I’ll just keep bashing my head against the wall…

                  Sedhead
                  Participant

                    Before I go digging through the code, I’m wondering why code would compile and run fine one week, then be “structured to not compile” the next. Do you have any idea why this might happen?

                    Here’s the full sketch, based off of Menu_a_la_carte:

                     

                    Sedhead
                    Participant

                      Well, that’s interesting. After running a compile check, I get:

                      RAM: [ ] 0.1% (used 9 bytes from 16384 bytes)
                      Flash: [ ] 0.4% (used 510 bytes from 130048 bytes)

                      And when I do the same for “Blink” I get:

                      RAM: [ ] 1.6% (used 266 bytes from 16384 bytes)
                      Flash: [ ] 1.7% (used 2252 bytes from 130048 bytes)

                      So, for some reason, even though it looks like it has compiled correctly and uploaded correctly, nothing is actually getting uploaded. Would the code help here? Or the platformio.ini file? Happy to share both.

                      Sedhead
                      Participant

                        Thanks for the reply, Neil. I tried using “upload_port” in platformio.ini and there was no change. Also restarted VSC a couple of times. Tried connecting with the Mayfly off and then on. The weird thing is that I can get simple code to load and work. But this Mayfly code, which is significantly more complex and lengthy, will compile fine, worked in the past, but now does not. As I said in my original post, the output looks like it has uploaded, but it goes way too fast and the sketch clearly isn’t loaded because I get no output on the serial monitor.

                        It seems like there are multiple steps in the upload process and I’m wondering if the order makes a difference?

                        • Mayfly off or on when you connect it to the USB port (i.e. when do you turn the Mayfly on?)
                        • VSC open or closed when you connect Mayfly to the port (i.e. when do you start up VSC?)

                        I’m flummoxed.

                      Viewing 10 posts - 1 through 10 (of 14 total)