Daisyduino OLED for patchSM

I have a SSD 1309 hooked up to my patchSM, and I’m trying to get it to work for daisyduino.

I came across this example, but it uses the raw pin numbers of the seed to set up the pins.

// Title: Oled
// Description: Bounces a character around the screen.
// Hardware: Daisy Patch
// Author: Ben Sergentanis

#include "DaisyDuino.h"
#include <U8g2lib.h>

DaisyHardware hw;

// the magic incantation
U8G2_SSD1309_128X64_NONAME2_F_4W_SW_SPI oled(U8G2_R0, /* clock=*/8,/* data=*/10, /*cs=*/7, /* dc=*/9,/* reset=*/30);

int x, y;
int xvel, yvel;
char str[] = "daisypatch";
int pos;

void setup() {
  hw = DAISY.init(DAISY_PATCH, AUDIO_SR_48K);
  x = y = 30;
  xvel = yvel = -1;
  pos = 0;

  oled.setFont(u8g2_font_inb16_mf);
  oled.setFontDirection(0);
  oled.setFontMode(1);
  oled.begin();
}

void loop() {
  oled.clearBuffer();

  char c[] = {str[pos]};
  oled.drawStr(x, y, c);
  x += xvel;
  y += yvel;

  if (x <= 0 || x >= 110) {
    xvel *= -1;
    pos++;
    pos %= 10;
  }

  if (y <= 16 || y >= 64) {
    yvel *= -1;
    pos++;
    pos %= 10;
  }

  oled.sendBuffer();
  delay(5);
}

But the patch SM doesn’t have raw pin numbers, so I’m basically wondering how this can be adapted to work on a daisy patchSM? My oled is connected as follows:

SCL - D10
SDA - D9
dc - D8
res - D7
cs - D1

Any help will be hugely appreciated :slight_smile:

I’ve managed to get the Oled.ino to work with the Patch SM:

I initialized the Oled with the following:

// the magic incantation
U8G2_SSD1309_128X64_NONAME2_F_4W_SW_SPI oled(U8G2_R0,
/* clock=/ PIN_PATCH_SM_D10,
/
data=/ PIN_PATCH_SM_D8,
/
cs=/ PIN_PATCH_SM_D1,
/
dc=/ PIN_PATCH_SM_D9,
/
reset=*/ PIN_PATCH_SM_D3);
I wired it up as follows:

Display Pin Daisy SM Pin
VCC… A10
GND… A7
SCK … D10
SDA … D9
RES …D3
DC …D8
CS …D1

2 Likes

Thank you JonC!

You’re very welcome!