Skip to content

Instantly share code, notes, and snippets.

Created January 30, 2018 11:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/2b592dbb1f0f1c0dadaf1e4547cd0eec to your computer and use it in GitHub Desktop.
Save anonymous/2b592dbb1f0f1c0dadaf1e4547cd0eec to your computer and use it in GitHub Desktop.
Simple Python program to flash onboard LED of Arduino UNO. Requires pyfirmata.
@brun0eduard0
Copy link

brun0eduard0 commented Jun 25, 2019

from pyfirmata import Arduino, util
import time

// WINDOWS
board = Arduino("COM3")
//LINUX
//board = Arduino("/dev/ttyACM0")

loopTimes = input('How many times would you like the LED to blink: ')
print("Blinking %d times.", loopTimes)

for x in range(int(loopTimes)):

board.digital[13].write(1)
time.sleep(0.2)
board.digital[13].write(0)
time.sleep(0.2)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment