translation missing: en.general.accessibility.skip_to_content
Using the Cool Components Teensy Adapters (Grove & Qwiic)

Using the Cool Components Teensy Adapters (Grove & Qwiic)

We recently launched our range of Teensy Adapters aimed at making it as easy as possible to use Grove and Qwiic products with your favourite Teensy microcontroller. There is a mixed board, full Grove and full Qwiic options depending on what your project requires.

 

Using the Qwiic, Grove I2C and UART connectors is as simple as plugging in your component and programming the Teensy. With Grove products that use the digital and analogue connectors it's as simple as connecting them and simply changing the input pin in your code. We've got some examples of using different products witht the adapters below to show how simple it is.

Using a Qwiic Product

Using a Qwiic device with our adapters is a simple as plugging them in and programming the Teensy. The connectors are connected to the Teensys I2C bus so you won't need to change anything in your code. 

We're going to connect and use the Qwiic MP3 Trigger to output a MP3 file from the SD card inserted into the trigger. To do this we're going to connect a Mini Metal Speaker to the terminals on the trigger and then connect it to the Teensy adapter using a Qwiic cable.

Now all we need to do is program it using some of the example code provided in the SparkFun library, we don't need to change any of the code it's as simple as programming the Teensy.

Using a Digital Grove Product

Using a digital connector on the Teensy adapter is extremely similar to how you'd use a Grove product with any other shield. Simply connect it to one of the digital connectors and define that pin in your code. To demonstrate this we'll be connecting the Grove - LED to D6 on our board. 

We'll be using the example code from the Seeed Wiki page, all you'll need to change if the section of code where the pin we're using is defined. The example code was created for pin 2 and is as follows "#define LED 2". As we are using D6 all we need to do is change the definition to 6 instead of 2. Once verified and uploaded the LED flashes as expected.

Using a Analogue Grove Product

We're going to connect the Grove - Rotary Angle Sensor to the A3 connector on the Teensy Adapter - Gove using a Grove cable. To read the output from this sensor we'll use the example code provided on the Seeed Wiki. It's as simple as copying over the code and changing one line that defines which input is being used.

In the code there is the following line "#define ROTARY_ANGLE_SENSOR A0". All we need to do is change the A0 part to whichever analogue connector is being used. In this case we're using A3 so we'll change the line to "#define ROTARY_ANGLE_SENSOR A3" now we just need to upload the code to the Teensy and open a serial monitor to view the outputed values. 

  

 

Previous article How to Use a PIR Sensor with a Microcontroller
Next article Our Top Micro:Bit Gifts this Christmas