Skip to content

Instantly share code, notes, and snippets.

View MatthewScholefield's full-sized avatar

Matthew D. Scholefield MatthewScholefield

View GitHub Profile
@MatthewScholefield
MatthewScholefield / PythonArduino.py
Last active February 9, 2018 06:29 — forked from jreisstudio/PythonArduino.py
Python + Arduino on/off the LED.
import serial # you need to install the pySerial :pyserial.sourceforge.net
import time
with open('RMS_EMG.txt') as f:
lines = f.read().split('\n')
arduino = serial.Serial('/dev/tty.usbserial', 9600)
for line in lines:
brightness = int(float(line.split(',')[-1]) * 255)
arduino.write(bytes(str(brightness), 'ascii'))