I'm a newbie in Arduino and trying to check my python script in Arduino is running or not.
I placed the python script(sample.py
) in /mnt/sda1/arduino/www/
which is in SD card.
From the scratch file, I wrote it like below,
Process p;
void setup() {
// put your setup code here, to run once:
Bridge.begin();
Serial.begin(115200);
}
void loop() {
// put your main code here, to run repeatedly:
p.runShellCommandAsynchronously("/usr/bin/python -U /mnt/sda1/arduino/www/sample.py");
while(p.running());
if(p.available()>0){
userInput = p.read();
Serial.println(userInput);
}
}
And here is my python script code(sample.py
) on below,
import serial
ser = serial.Serial('COM5', baudrate = 115200, timeout=1)
ser.write('g')
What I'm trying to do here is checking my python script is running. However, it shows nothing on Serial monitor.
What am I doing wrong here..?
Can Anybody help me out here??
Or can anybody give me an example code(scratch code) to check python script is running or not?
Thanks in advance.