From 34e3da81897e813958acf534ee896deb9c741ee6 Mon Sep 17 00:00:00 2001 From: Augusto Zanellato Date: Mon, 10 Sep 2018 23:59:50 +0200 Subject: [PATCH 1/2] Added support for Leonardo and Micro (32u4) --- pyfirmata/boards.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pyfirmata/boards.py b/pyfirmata/boards.py index ca5adad1..f01ee488 100644 --- a/pyfirmata/boards.py +++ b/pyfirmata/boards.py @@ -26,5 +26,19 @@ 'pwm': (3, 5, 6, 9, 10, 11), 'use_ports': True, 'disabled': (0, 1) # Rx, Tx, Crystal + }, + 'arduino_leonardo': { + 'digital': tuple(x for x in range(17)), + 'analog': tuple(x for x in range(14)), + 'pwm': (3, 5, 6, 9, 10, 11, 12, 13), + 'use_ports': True, + 'disabled': () # Rx, Tx, Crystal + }, + 'arduino_micro': { + 'digital': tuple(x for x in range(17)), + 'analog': tuple(x for x in range(14)), + 'pwm': (3, 5, 6, 9, 10, 11, 12, 13), + 'use_ports': True, + 'disabled': () # Rx, Tx, Crystal } } From ded3ee145b16b1aec66383687043f0fc18af7061 Mon Sep 17 00:00:00 2001 From: Augusto Zanellato Date: Tue, 11 Sep 2018 00:03:24 +0200 Subject: [PATCH 2/2] Added support for Leonardo and Micro (32u4) --- pyfirmata/__init__.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/pyfirmata/__init__.py b/pyfirmata/__init__.py index f3ce6ee4..4a332460 100644 --- a/pyfirmata/__init__.py +++ b/pyfirmata/__init__.py @@ -59,3 +59,27 @@ def __init__(self, *args, **kwargs): def __str__(self): return "Arduino Nano {0.name} on {0.sp.port}".format(self) + +class ArduinoMicro(Board): + """ + A board that will set itself up as an Arduino Due. + """ + def __init__(self, *args, **kwargs): + args = list(args) + args.append(BOARDS['arduino_micro']) + super(ArduinoMicro, self).__init__(*args, **kwargs) + + def __str__(self): + return "Arduino Micro {0.name} on {0.sp.port}".format(self) + +class ArduinoLeonardo(Board): + """ + A board that will set itself up as an Arduino Due. + """ + def __init__(self, *args, **kwargs): + args = list(args) + args.append(BOARDS['arduino_leonardo']) + super(ArduinoLeonardo, self).__init__(*args, **kwargs) + + def __str__(self): + return "Arduino Leonardo {0.name} on {0.sp.port}".format(self)