QT Py 2040 Code not uploading Arduino Ide

Adafruit's tiny microcontroller platforms. Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Post Reply
User avatar
03D_tech
 
Posts: 1
Joined: Mon Feb 03, 2025 11:00 am

QT Py 2040 Code not uploading Arduino Ide

Post by 03D_tech »

Hey everyone,
I recently purchased a QT Py 2040 to use in conjunction with a magnetometer, but have been having issues with uploading code to the board from the Arduino Ide. I've successfully installed all of the necessary libraries and board managers for the board as instructed through the documentation, but when it comes to uploading even just the blink sketch, the board doesn't output anything or blink any of it's LEDs. The console shows that a certain amount of bytes were written to the device, but nothing happens.
Thanks in advance.

User avatar
mikeysklar
 
Posts: 18621
Joined: Mon Aug 01, 2016 8:10 pm

Re: QT Py 2040 Code not uploading Arduino Ide

Post by mikeysklar »

This board doesn't support traditional blink. No onboard single-color LED.
Now traditionally you would use an onboard LED to make a blink occur. However, this board does not have an onboard single-color LED, so we will 'mimic' the same blink sketch but instead of using a digital output pin, we will use NeoPixel support to blink the onboard RGB LED!
Use the NeoPixel version for this one.

Code: Select all

#include <Adafruit_NeoPixel.h>

// How many internal neopixels do we have? some boards have more than one!
#define NUMPIXELS        1

Adafruit_NeoPixel pixels(NUMPIXELS, PIN_NEOPIXEL, NEO_GRB + NEO_KHZ800);

// the setup routine runs once when you press reset:
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
}

// the loop routine runs over and over again forever:
void loop() {
  // say hi
  Serial.println("Hello!");
  
  // set color to red
  pixels.fill(0xFF0000);
  pixels.show();
  delay(500); // wait half a second

  // turn off
  pixels.fill(0x000000);
  pixels.show();
  delay(500); // wait half a second
}

Post Reply
Please be positive and constructive with your questions and comments.

Return to “Trinket, Trinkey and QT Py”