Trouble using Steema/QWIIC on QT PY RP2040?

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
leewcj
 
Posts: 1
Joined: Tue Feb 28, 2023 8:54 am

Trouble using Steema/QWIIC on QT PY RP2040?

Post by leewcj »

I most likely have multiple issues but my goal is to test the ability of the QTPY to work with some of my SparkFun QWIIC devices. Particularly the AS6212 Digital Temperature Sensor Breakout. I have created a simple program to test the QTPY and have no issues there. But when I try to use an example file for the AS6212 in Arduino I have no luck. Using the code alone I get no compile errors but I also receive no monitor output. When I tried to incorporate a simple flash of the Neopixel, as a way of checking the code, I get a compile error:
...\Documents\Arduino\Example_01_BasicReadings_playing_around\Example_01_BasicReadings_playing_around.ino:28:3: error: 'pixels' was not declared in this scope
28 | pixels.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
| ^~~~~~

exit status 1

Compilation error: 'pixels' was not declared in this scope
Here is the code for the AS6212 with the call to the neopixel:
#include <Adafruit_NeoPixel.h>
#include "SparkFun_AS6212_Qwiic.h" //Click here to get the library: http://librarymanager/All#SparkFun_AS6212
#include <Wire.h>

#define NUMPIXELS 1

AS6212 sensor;

//Initialize temperature variables as floats
float tempC;
float tempF;

void setup() {

Serial.begin(115200);

#if defined(NEOPIXEL_POWER)
// If this board has a power control pin, we must set it to output and high
// in order to enable the NeoPixels. We put this in an #if defined so it can
// be reused for other boards without compilation errors
pinMode(NEOPIXEL_POWER, OUTPUT);
digitalWrite(NEOPIXEL_POWER, HIGH);
#endif

pixels.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
pixels.setBrightness(20); // not so bright
pixels.fill(0x00FF00);
pixels.show();

Serial.println("SparkFun AS6212 Qwiic Example 1 - Basic Readings");

Wire.begin();

}

void loop() {
tempC = sensor.readTempC();
tempF = sensor.readTempF();

Serial.println();
Serial.print("Temperature (°C): ");
Serial.print(tempC, 6); //Reads out 6 characters of the temperature float
Serial.print("\tTemperature (°F): ");
Serial.println(tempF, 6); //Reads out 6 characters of the temperature float

delay(1000);
}
I have checked to make sure I'm using the correct port and baud rate. I have validated that both the Neopixel and AS6212 libraries are loaded in Arduino.

What am I missing?

Thanks

User avatar
dastels
 
Posts: 15608
Joined: Tue Oct 20, 2015 3:22 pm

Re: Trouble using Steema/QWIIC on QT PY RP2040?

Post by dastels »

The STEMMA-QT I2C is on Wire1, not Wire. See https://learn.adafruit.com/adafruit-qt- ... qt-3091651.

Dave

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”