Skip to content

Instantly share code, notes, and snippets.

@iflowfor8hours
Created January 18, 2018 02:21
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 iflowfor8hours/8144d0d6bf58d0fb52e17c8790c8d01a to your computer and use it in GitHub Desktop.
Save iflowfor8hours/8144d0d6bf58d0fb52e17c8790c8d01a to your computer and use it in GitHub Desktop.
Shell output from getting the pro micro to go to bootstrap mode
slide ~/src/6112884-pro-micro-controller $ virtualenv venv
New python executable in /home/matt/src/6112884-pro-micro-controller/venv/bin/python2.7
Also creating executable in /home/matt/src/6112884-pro-micro-controller/venv/bin/python
Installing setuptools, pip, wheel...done.
slide ~/src/6112884-pro-micro-controller $ python --version
Python 2.7.14
slide ~/src/6112884-pro-micro-controller $ pip install -r requirements.txt
Collecting pyserial==2.7 (from -r requirements.txt (line 1))
Installing collected packages: pyserial
Found existing installation: pyserial 3.4
Uninstalling pyserial-3.4:
Successfully uninstalled pyserial-3.4
Successfully installed pyserial-2.7
slide ~/src/6112884-pro-micro-controller $ cat reset.py
#!/usr/bin/env python
import serial, sys
serialPort = sys.argv[1]
print serialPort
ser = serial.Serial(
port=serialPort,
baudrate=1200,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS
)
ser.isOpen()
ser.close() # close port
slide ~/src/6112884-pro-micro-controller $ ./reset.py /dev/ttyACM0
/dev/ttyACM0
Traceback (most recent call last):
File "./reset.py", line 13, in <module>
bytesize=serial.EIGHTBITS
File "/home/matt/.pyenv/versions/2.7.14/lib/python2.7/site-packages/serial/serialutil.py", line 282, in __init__
self.open()
File "/home/matt/.pyenv/versions/2.7.14/lib/python2.7/site-packages/serial/serialposix.py", line 289, in open
self.fd = os.open(self.portstr, os.O_RDWR|os.O_NOCTTY|os.O_NONBLOCK)
OSError: [Errno 13] Permission denied: '/dev/ttyACM0'
slide ~/src/6112884-pro-micro-controller $ ls -la /dev/ttyACM0
crw------- 1 root root 166, 0 Jan 17 18:08 /dev/ttyACM0
slide ~/src/6112884-pro-micro-controller $ sudo chmod 777 /dev/ttyACM0
slide ~/src/6112884-pro-micro-controller $ ls -la /dev/ttyACM0
crwxrwxrwx 1 root root 166, 0 Jan 17 18:08 /dev/ttyACM0
slide ~/src/6112884-pro-micro-controller $ lsusb | grep Arduino
Bus 001 Device 015: ID 2341:8036 Arduino SA Leonardo (CDC ACM, HID)
slide ~/src/6112884-pro-micro-controller $ ./reset.py /dev/ttyACM0
/dev/ttyACM0
slide ~/src/6112884-pro-micro-controller $ lsusb | grep Arduino
Bus 001 Device 016: ID 2341:0036 Arduino SA
slide ~/src/6112884-pro-micro-controller $ lsusb | grep Arduino
Bus 001 Device 017: ID 2341:8036 Arduino SA Leonardo (CDC ACM, HID)
slide ~/src/6112884-pro-micro-controller $
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment