i'm setting pi use serial arduino mega. i'd use simple python scripts toggle pins on arduino. i'm getting started simple python blink script works expected until end when serial port closes. note i've tried leave port open same result. want leave pin high when script completes turns arduino pin low, in case pin 12.
how can write script pin stays high after serial port closes?
how can write script pin stays high after serial port closes?
code: select all
import time import serial ser = serial.serial('/dev/ttyacm0', 9600) ser.write('h') print("h") time.sleep(1) ser.write('l') print("l") time.sleep(1) ser.write('h') print("h") time.sleep(.5) ser.write('l') print("l") time.sleep(.5) ser.write('h') print("h") time.sleep(1) ser.write('l') print("l") time.sleep(1) ser.write('h') print("h") time.sleep(1) ser.write('l') print("l") time.sleep(1) ser.write('h') print("h") time.sleep(2) ser.close()
surely problem @ arduino end?
raspberrypi
Comments
Post a Comment