• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Download a non-python file using uPyCraft to an ESP32

Q&A Forum › Category: ESP32 › Download a non-python file using uPyCraft to an ESP32
0 Vote Up Vote Down
Scott Dahl asked 4 years ago

Hello,
Has any one been able to download a *.txt  file from uPyCraft to an esp32?
Are there other means to do this?
It appears uPyCraft will only download a  *.py  fiile.
Note, I could have the main.py file create this file on the ESP32 to store persistent data 
between deepsleep wake-ups but creating this file in advance simplifies my design.
 
Thanks,
Scott

Question Tags: download, ESP32, MicroPython
3 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

Hi.
You can use ampy.
Take a look at this tutorial: https://techtutorialsx.com/2017/06/04/esp32-esp8266-micropython-uploading-files-to-the-file-system/
I think this is what you are looking for.
Regards,
Sara

0 Vote Up Vote Down
Scott Dahl answered 4 years ago

Thanks Sara,
That is what I’m looking for.
Yesterday I can up with a hack to have a non-python file on the ESP32.

  1. Create an empty python file.   For example  ‘Foo.py’
  2. Download Foo.py to the ESP32 with uPyCraft
  3. Run “import os”
  4. Run os.name(‘Foo.py’, ‘Foo.txt’)
  5. f = open(‘Foo.txt’)
  6. f.write(‘somedata’)
  7. f.close()

I tested this procedure and it works.
 
Thanks,
Scott
 
 

0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

That’s great!
Thanks for sharing it.
It may be useful for other people too.
I’ll mark this issue as resolved. If you need further help, you just need to open a new question in our forum.
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.