Skip to content

Commit e1088ee

Browse files
committed
Update qwiic.md
1 parent bc04804 commit e1088ee

File tree

1 file changed

+25
-2
lines changed
  • content/hardware/02.hero/boards/uno-r4-wifi/tutorials/qwiic

1 file changed

+25
-2
lines changed

content/hardware/02.hero/boards/uno-r4-wifi/tutorials/qwiic/qwiic.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ In this tutorial you will learn how to use the Qwiic connector on the Arduino UN
1414

1515
We will walk through the concept of I2C, and how it relates to the Qwiic ecosystem.
1616

17-
You'll learn
17+
You'll learn what Qwiic is, as well as how to set it up and get started making your own Qwiic system with the Arduino UNO R4 WiFi.
1818

1919
![The Qwiic connector of the Arduino UNO R4 WiFi](./assets/Qwiic-connector.png)
2020

@@ -71,7 +71,30 @@ This *can* get problematic in some instances depending on the library developed
7171
In most cases, however, you will be able to select the `Wire1` object when initialising the library in a fashion similar to this:
7272

7373
```arduino
74-
libraryName.begin( &Wire1 );
74+
Wire1.begin();
75+
libraryName.begin( Wire1 );
76+
```
77+
78+
For example, when using SparkFuns AHT20 library, your setup function could look something like this:
79+
```arduino
80+
#include <Wire.h>
81+
82+
#include <SparkFun_Qwiic_Humidity_AHT20.h>
83+
84+
85+
void setup(){
86+
Serial.begin(115200);
87+
88+
Wire1.begin(); //Join I2C bus
89+
90+
//Check if the AHT20 will acknowledge
91+
if (humiditySensor.begin( Wire1 ) == false)
92+
{
93+
Serial.println("AHT20 not detected. Please check wiring. Freezing.");
94+
while (1);
95+
}
96+
Serial.println("AHT20 acknowledged.");
97+
}
7598
```
7699

77100
## Summary

0 commit comments

Comments
 (0)