
Instead we have to locate the library for our chosen board, in our case Adafruit’s MPR121 touch sensor code. But it wasn’t quite that simple.Īrduino relies on the Wire.h library to configure the I2C interface, and we can’t just import it into our code. The Arduino Uno R4 WiFi cheatsheet, which we only later found, identified the secondary I2C bus and helpfully told us what to do in order to make it work with our range of StemmaQT add on boards.
Arduino creations software#
More is a good thing, right? Well yes it is, but software has to catch up to this innovation. Normally, Arduinos have just a single I2C connection, but the addition of the Qwiic connection means that the R4 WiFi has two. Yes the same Qwiic connector offered by SparkFun, Adafruit (StemmaQT), Pimoroni (QW/ST) and Cytron (Maker Port) is present on the R4 WiFi and while this is a most welcome addition, it also brings a problem. This issue only applies to the Arduino Uno R4 WiFi, and the sole reason for that is the inclusion of a Qwiic connector. It will eventually catch up, but you may have to get your hands dirty to make things work, something we’ll cover later. These same shields are electrically compatible with the Arduino R4 boards, but the caveat is that the software may require some tweaking. We have Shields for Ethernet, LCD screens, Audio Synths and we even made our own Shield to flash ATTiny85 microcontrollers. Using Shields with an Arduino, we benefit from ready-made platforms on which we can base our projects.
Arduino creations code#
A quick tweak and flashing the code to the Arduino saw the problem resolved. A press of the text and the motor sprang to life, then we pressed the other text element to turn it off and then we realized that we had forgotten to change the GPIO pin.

With the connections made we flashed the code, then went back to the browser. The Arduino GPIO can only supply 8mA per GPIO pin, nowhere near what a motor requires. How about a web controlled motor? Using the example code, with a slight tweak for the GPIO pins, we connected a DC motor to the Arduino via a Cytron Maker Drive motor controller. With the tests out of the way, we can be a little more adventurous. Clicking the On / Off text then triggered the LED to change state. We chose the latter and after adding our Wi-Fi details we then flashed the board and went to Arduino Uno R4 WiFi’s IP address. The example can either be its own Wi-Fi access point, or we can assign it to our existing network. The goal of the web example is to create a web server and host a simple HTML page that we can use to control the status of the onboard LED. The onboard ESP32 is an incredibly powerful microcontroller in its own right, but acting as a co-processor it offloads all of the networking that would slow down the 48 MHz Arm CPU. For the R4 WiFi, we chose to use an example that uses the ESP32’s Wi-Fi connectivity along with the R4’s Arm CPU.

Flashing the code took under 30 seconds and all was good. Starting with the Minima, we updated the standard Blink sketch to use a for loop that would blink the LED a few times before stopping, then repeating. After that we ventured into File > Examples and selected a series of example sketches for the boards.
Arduino creations drivers#
It even downloaded the latest drivers and configuration for the new boards. Installing the Arduino IDE and connecting the Arduino Uno R4 boards to the computer, and we see the IDE detect and configure the boards for use.
