# Adafruit QT Py RP2040 (ADA4900)

**URL:** <https://forum.core-electronics.com.au/t/adafruit-qt-py-rp2040-ada4900/19882>\
**Category:** Product Questions\
**Created:** [7 May 2024 00:11 UTC](https://forum.core-electronics.com.au/t/adafruit-qt-py-rp2040-ada4900/19882 "2024-05-07T00:11:38Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![Pixmusix](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/pixmusix/32/9719_2.png) [@Pixmusix](https://forum.core-electronics.com.au/u/Pixmusix)\
**Post date:** [30 May 2024 12:40 UTC](https://forum.core-electronics.com.au/t/adafruit-qt-py-rp2040-ada4900/19882/6 "2024-05-30T12:40:12Z")

</div>

@Michael I’m redirecting to this thread. 🙂  
Linking from the below because this isn’t really relevant to that guide any more.

> [@Guide by Brenton; Makerverse Micro SD Adapter - MicroPython Guide and Data Logging](https://forum.core-electronics.com.au/t/guide-by-brenton-makerverse-micro-sd-adapter-micropython-guide-and-data-logging/14670/19):
>
> It might be time for the sanity check - can you upload some photos of how things are connected, and also tell us what format + size the SD card is?

#### My build chain

[![](https://img.youtube.com/vi/0Hy1qNaey18/maxresdefault.jpg "ce audiobff buildchain") ](https://www.youtube.com/watch?v=0Hy1qNaey18)

#### Here is the guide I’m following.

[https://git.emacinc.com/micropython-public/micropython-i2s-examples/-/blob/emac-support/examples/easy\_wav\_player.py](https://git.emacinc.com/micropython-public/micropython-i2s-examples/-/blob/emac-support/examples/easy_wav_player.py)

#### I have had to swap to a different SD card library since the code above no longer works.

> [@Micropython Machine Module and SD cards](https://forum.core-electronics.com.au/t/micropython-machine-module-and-sd-cards/20060/2):
>
> Hey Pixmusix, From what I can tell from the code used in this link they are using a big if/else statement to determine what board is being used before they import the required library. Looking at the documentation for SD card use in MicroPython I think this library call method is incorrect. I think it should be import os import machine import sdcard With ‘sdcard’ being called in lowercase and as a separate library. The documentation at the below link made sense to me, hopefully you can m…

#### Here is the wrapper around the guide above.

```python
### THIS NEEDS TO BE A CLASS

from wavplayer import WavPlayer
import os
from machine import Pin, SPI, I2S
import sdcard

def play():
    wp.play("hello.wav", loop=True)
    return is_playing()

def pause():
    wp.pause()
    
def resume():
    wp.resume()
    
def is_playing():
    return wp.isplaying()
    
    
# ======= SD CARD CONFIGURATION =======
#sd = SDCard(slot=1, sck=Pin(6), mosi=Pin(3), miso=Pin(4), cs=Pin(29))
sd_pin = Pin(29)
sd_spi = SPI(0)
sd = sdcard.SDCard(sd_spi, sd_pin)
os.mount(sd, "/sd")

# Read files from SD card
print("my list:")
for filename in os.listdir("/sd"):
    print(filename)

# Init Audio
'''
    A1 - This is used for audio data, or DAT.
    A2 - This is used for wordselect clock, or LR.
    A3 - This is used for bitclock, or BCLK.
'''
audio_clk_pin = Pin(26)
audio_word_pin = Pin(27)
audio_data_pin = Pin(28)

#Construct the wp
wp = WavPlayer(id=0, sck_pin=Pin(audio_clk_pin), ws_pin=Pin(audio_word_pin), sd_pin=Pin(audio_data_pin), ibuf=44100)

```

#### Here is the offending code.

```python
play() #<----
while is_playing():
    if button.is_pressed:
        pause()

```

#### Goal

It’s all feeling like I’m on the wrong path entirely in terms of my build chain.  
I will entertaining loading from SD onto flash first and reading from flash. 🙂  
Nothing here is real time. 99% of the time this chip will be idle so I have plenty of time of read-write blocking code.

Thanks.  
Pix ❣

---

_[View the full topic](https://forum.core-electronics.com.au/t/adafruit-qt-py-rp2040-ada4900/19882)._
