Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 32b2f8f

Browse files
committed
include <Wire.h> before <Arduino_Helpers.h>
1 parent a66c124 commit 32b2f8f

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

examples/Arduino-Helpers/Hardware/Extended Input & Output/3. In&Out/MCP23017/MCP23017.ino

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,19 @@
2626
* https://github.com/tttapa/Arduino-Helpers
2727
*/
2828

29+
#include <Wire.h>
30+
2931
#include <Arduino_Helpers.h>
32+
3033
#include <AH/Hardware/ExtendedInputOutput/MCP23017.hpp>
31-
#include <Wire.h>
3234

3335
using namespace ExtIO; // Use the extended input/output functions
3436

3537
using WireType = decltype(Wire); // The type of the I²C driver to use
3638
MCP23017<WireType> mcp {
3739
Wire, // The I²C driver to use
3840
0x0, // The I²C address offset (depends on the state of the address pins)
39-
2, // Optional: interrupt pin to detect input changes
41+
2, // Optional: interrupt pin to detect input changes
4042
};
4143

4244
pin_t ledPin = mcp.pinA(0); // GPIOA0
@@ -56,8 +58,8 @@ void loop() {
5658
digitalWrite(ledPin, buttonState ? LOW : HIGH);
5759
}
5860

59-
// Note:
60-
// The “interrupt” pin is not used to trigger an actual interrupt on the
61+
// Note:
62+
// The “interrupt” pin is not used to trigger an actual interrupt on the
6163
// microcontroller. It is just used to check whether any of the inputs of
6264
// the MCP23017 changed without having to do an I²C transaction. Using this
6365
// pin can speed up your code, but it's not necessary, you can leave it out

examples/Arduino-Helpers/Hardware/MCP23017-Encoders/MCP23017-Encoders-Interrupts/MCP23017-Encoders-Interrupts.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@
4949
* https://github.com/tttapa/Arduino-Helpers
5050
*/
5151

52+
#include <Wire.h>
53+
5254
#include <Arduino_Helpers.h>
5355

5456
#include <AH/Hardware/MCP23017Encoders.hpp>
5557
#include <AH/PrintStream/PrintStream.hpp>
5658

57-
#include <Wire.h>
58-
5959
using WireType = decltype(Wire); // The type of I²C driver to use
6060
using EncoderPositionType = int32_t; // The type for saving encoder positions
6161
constexpr bool IntSafe = true; // Make it safe to call `update` in an ISR
@@ -82,7 +82,7 @@ void setup() {
8282

8383
void loop() {
8484
// No `enc.update()` here, everything happens inside of the ISR
85-
85+
8686
// Save the previous positions
8787
static EncoderPositionType prevPositions[8] {};
8888
// Check if an encoder position changed and print it

examples/Arduino-Helpers/Hardware/MCP23017-Encoders/MCP23017-Encoders-No-Interrupts/MCP23017-Encoders-No-Interrupts.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@
4747
* https://github.com/tttapa/Arduino-Helpers
4848
*/
4949

50+
#include <Wire.h>
51+
5052
#include <Arduino_Helpers.h>
5153

5254
#include <AH/Hardware/MCP23017Encoders.hpp>
5355
#include <AH/PrintStream/PrintStream.hpp>
5456

55-
#include <Wire.h>
56-
5757
using WireType = decltype(Wire); // The type of I²C driver to use
5858
using EncoderPositionType = int32_t; // The type for saving encoder positions
5959
using MCPEncoderType = MCP23017Encoders<WireType, EncoderPositionType>;

0 commit comments

Comments
 (0)