nano /mnt/sda1/ftpupload.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
import ftplib
ftp = ftplib.FTP('server.address.com','USERNAME','PASSWORD')
file = open('/mnt/sda1/data.dat','rb') # file to send
ftp.cwd('yun') # change into "yun" directory from ftp root
ftp.storbinary('STOR data.dat', file) # send the file
file.close() # close file and FTP
ftp.quit()
chmod 755 /mnt/sda1/ftpupload.py

Testing:

/mnt/sda1/ftpupload.py

ATmega32u4 code:

#include <Process.h>
void setup() {
 Bridge.begin();  // Initialize Bridge
}
void loop() {
 Process p;              
 p.begin("/mnt/sda1/ftp.py");      
 p.run();
 delay(60000); 
}

Active ftp site only situation:

ftp.set_pasv("0")

 

 

Comments powered by CComment