Sonny,
I tried your examples with the Python and Sqllite3. I can get the examples to work but when I modify to meet my needs it doesn't work. Obviously I have some syntax wrong and I think it's in the Python file.
Using the sqltimestamp example I added some columns so the table is as follows:
[id,zone,sample,count,timestamp] where zone id = integer, zone = integer, sample= archer, count = varchar, timestamp = default time similar to your example.
When I run the script on the command line in shell with the insert command everything works fine. But when I use the arduino sketch and the python code I get an error referring to line 4 of the python code.
When I run your python arduino sql example the python code works fine.
What am I missing/doing wrong?
Here is the modified python file:
#!/usr/bin/python
import sqlite3 as sqlite
import sys
script,zone,sample,count = sys.argv
con = sqlite.connect('/mnt/sda1/sensor_flow.db')
cur = con.cursor()
cur.execute('''INSERT INTO tablica (zone, sample, count) VALUES(?,?,?)''',(zone, sample, count))
con.commit()
con.close()
Here is the modified Arduino code:
#include <Process.h>
int z=2;
long int s = 0;
long int c;
void setup() {
Bridge.begin(); // Initialize Bridge
}
void loop() {
s++;
c = random(0,300);
Process p; // Create a process and call it "p"
p.begin("/mnt/sda1/pythonsqlite3.py"); // Process that launch the "pythonsqlite3.py" command
p.addParameter(String(z)); // Add the parameter to "zone"
p.addParameter(String(s)); // Add the parameter to "sample"
p.addParameter(String(c)); // Add the parameter to "sample"
p.run(); // Run the process and wait for its termination
delay(10000);
}