Use str(datetime.now())
touch /mnt/sda1/datalog.csv
nano /mnt/sda1/datalog.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
from datetime import datetime
data_rcv=sys.argv[1] +"," + sys.argv[2] +"," + str(datetime.now())
f = open('/mnt/sda1/datalog.csv','a')
f.write(data_rcv)
f.write('\n')
f.close()
chmod 755 /mnt/sda1/datalog.py
Testing:
/mnt/sda1/datalog.py '1' '2'
#include <Process.h>
void setup() {
// Initialize Bridge
Bridge.begin();
}
void loop() {
Process p;
p.begin("/mnt/sda1/datalog.py");
p.addParameter("1");
p.addParameter("2");
p.run();
delay(10000);
}