Search found 10 matches
- Wed Aug 02, 2017 3:00 am
- Forum: General Discussion and Questions
- Topic: How do you move files inside sdcard with micropython?
- Replies: 20
- Views: 25547
Re: How do you move files inside sdcard with micropython?
Yes. f.readlines() would read all lines in the file and put the into a list. so you could do it like: f = open('/sd/data/data5.csv') content = f.readlines() f.close() for data in content: u2.write(data.rstrip("\n")) or even simpler: f = open('/sd/data/data5.csv') for data in f: u2.write(data.rstrip...
- Tue Aug 01, 2017 11:25 am
- Forum: General Discussion and Questions
- Topic: How do you move files inside sdcard with micropython?
- Replies: 20
- Views: 25547
Re: How do you move files inside sdcard with micropython?
alright, solved it by implementing a few lines:
lines = f.readlines()
line = lines[iline]
u2.write(line)
if iline < len(lines):
iline = iline + 1
else:
iline = 0
lines = f.readlines()
line = lines[iline]
u2.write(line)
if iline < len(lines):
iline = iline + 1
else:
iline = 0
- Tue Aug 01, 2017 7:57 am
- Forum: General Discussion and Questions
- Topic: How do you move files inside sdcard with micropython?
- Replies: 20
- Views: 25547
Re: How do you move files inside sdcard with micropython?
Again, you overwrite the file handle f with a result of readline, which then gets a str type, which indede has no attribute close. Change your code to: if SDtoFTP == 1: f = open('/sd/data/data5.csv') data = f.readline() f.close() u2.write(data) SDtoFTP = 0 thanks for the help, sir. You saved me lot...
- Mon Jul 31, 2017 7:50 am
- Forum: General Discussion and Questions
- Topic: How do you move files inside sdcard with micropython?
- Replies: 20
- Views: 25547
Re: How do you move files inside sdcard with micropython?
I would not reassign the file handle, and writte instead if SDtoFTP == 1: f = open('/sd/data/data1', 'r') data = f.readlines() But it is hard to tell what happens unless we see the full picture. And please tell also, which board and micropython build you are using. sorry for the very late reply, i'...
- Wed Jul 26, 2017 4:21 am
- Forum: General Discussion and Questions
- Topic: How do you move files inside sdcard with micropython?
- Replies: 20
- Views: 25547
Re: How do you move files inside sdcard with micropython?
if SDtoFTP == 1: f = open('/sd/data/data1', 'r') f = f.readline() This looks strange, since you overwrite f, which is the file handle, with the content of the first line. It might work once, for the first line. If you use f.readlines(), then the full file is read at once. I did what you suggested a...
- Tue Jul 25, 2017 9:51 am
- Forum: General Discussion and Questions
- Topic: How do you move files inside sdcard with micropython?
- Replies: 20
- Views: 25547
Re: How do you move files inside sdcard with micropython?
You can use uos.mkdir(dir) to create a directory, like uos.mkdir("storage"), and use uos.rename() to move files, like: uos.rename("/SD/data0", "/SD/storage/data0"). Thanks! Another question, how do you send those text files to an FTP server instead of sending rawData over? if SDtoFTP == 1: f = open...
- Tue Jul 25, 2017 2:11 am
- Forum: General Discussion and Questions
- Topic: How do you move files inside sdcard with micropython?
- Replies: 20
- Views: 25547
How do you move files inside sdcard with micropython?
Hi all, I'm having troubles with my micropython board where I have several files(data0, data1, data2 etc...) on my /SD card directory where I want to move them to another directory, let's say: /SD/storage. And as new data are being logged to my micropython which is equipped with sensors at the same ...
- Mon Jul 17, 2017 2:55 am
- Forum: General Discussion and Questions
- Topic: Questions regarding SD card[SOLVED]
- Replies: 5
- Views: 4706
Re: Questions regarding SD card
No, that does not look like noise. It loks more like you loos some data to be logged while your code writes to SD. Like: 10568,000410,0.00,0.01,-0.99,0.00,10569,000411,0.00,0.01,-1.00,0.00,0.09,, , 4.07, 4.18 10570,000411,0.00,0.01,-0.99,0.00,0.39,, , 3.99, 4.17 could be: 10568,000410,0.00,0.01,-0....
- Fri Jul 14, 2017 5:48 am
- Forum: General Discussion and Questions
- Topic: Questions regarding SD card[SOLVED]
- Replies: 5
- Views: 4706
Re: Questions regarding SD card
Also another question I have regarding is the storing of data, for example when my data stores, i have these values as shown below: 10477,000411,0.00,0.00,-0.99,0.00,0.15,, , 3.97, 4.23 10478,000409,0.00,0.01,-1.00,0.00,0.30,, , 4.12, 4.26 10479,000410,0.00,0.01,-0.99,0.00,0.13,, , 4.04, 4.07 10480,...
- Thu Jul 13, 2017 9:38 am
- Forum: General Discussion and Questions
- Topic: Questions regarding SD card[SOLVED]
- Replies: 5
- Views: 4706
Questions regarding SD card[SOLVED]
Hello there amigos! I am new to micropython and i'm hoping to get some enlightenment here regarding sd card support. I'm currently working on a datalogger and while i've figured out how to store the incoming data to my sd card mounted on my board, i'm trying to figure out a way where i can call upon...