1

I just made a tiny code to change the colors of my led strip in Linux too (I already did it in C# on Windows).

import serial
ser = serial.Serial('/dev/ttyACM0', 9600)
ser.write(b'a')

When I type this into bash like this:

$sudo python2
>>>import serial
>>>ser = serial.Serial('/dev/ttyACM0', 9600)
>>>ser.write(b'a')
1

it's working fine, but if I then execute the .py script like this:

$sudo python2 light.py

The ser.write part seems not to work. I dont get an err msg or anything. But I know that it's communicatin with the arduino cause the Onboard LED flashes when I execute the script.

1 Answer 1

1

Okay, got it, the Arduino resets after getting serial input, I just added a 3 Seconds delay before writing the Serial data

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.