Adafruit Display with Arduino Mega

Good morning,

I’m a few days behind a project with a " Adafruit SHARP Memory Display Breakout - 2.7 400x240 Monochrome"

I’m trying to connect it with an Arduino Mega, but following a tutorial I found online, it asks me to download CircuitPython.

I wanted to know if there’s a version of CircuitPython for an ArduinoMega. The tutorial advises me to use an Arduino Metro M4, but I do not know if it could work equally with a MEGA, nor how.

Could someone help me or give me clues?

Tutorial:
https://www.mouser.es/datasheet/2/737/adafruit_sharp_memory_display_breakout-1900807.pdf

If your display looks like the picture in the Mouser link :
I strongly advise you to follow the Mouser Tutorial pages 1-8.

Forget about CircuitPython or the Bad_Apple example.

If the display does not look like the pictures, please post a link to the actual display that you have bought.

1 Like

Thank you for answering,

I linked it as it explains the . pdf
GND -> GND
5V -> Vin
Pin13 -> Clk
Pin11 -> DI
Pin10 -> CS
and this is the code I use

#include <Adafruit_GFX.h>
#include <Adafruit_SharpMem.h>

#define SHARP_SCK  13
#define SHARP_MOSI 11
#define SHARP_SS   10
#define SCREEN_WIDTH 400
#define SCREEN_HEIGHT 240

Adafruit_SharpMem display(SHARP_SCK, SHARP_MOSI, SHARP_SS, SCREEN_WIDTH, SCREEN_HEIGHT);

#define BLACK 0
#define WHITE 1

void setup(void)
{
  Serial.begin(9600);
  Serial.println("Hello!");

  // start & clear the display
  display.begin();
  display.clearDisplay();
}

void loop(void) 
{
    // Clean for start to Draw
    display.clearDisplay();
    drawText("Texto de prueba", 4, 18);
    drawNumber(123.567f, 4, 30);
    for(int j = 1; j <= 5; j++){
      drawBattery_1(j/5.0f);      
      for(int i = 20*(j-1); i < (j*20); i++){
        
        drawBar(i);
        
        display.refresh();
        delay(50);
      }
    }
    // Clean
    display.refresh();
}

void drawBar(float v){
  int16_t x = 20, y = 80, w = 100, h = 12;  
  // Draw Bar
  display.drawRect(x, y, w, h, BLACK);
  // Draw Charge
  if(v <= w){
    display.fillRect(x, y, v, h, BLACK);
  }
}

void drawNumber(float n, int x, int y){
  display.setTextSize(1);
  display.setTextColor(BLACK);
  display.setCursor(x, y);
  display.println(n);
}

void drawText(const char* txt, int x, int y){
  display.setTextSize(1);
  display.setTextColor(BLACK);
  display.setCursor(x,y);
  display.println(txt);
}

void drawBattery_1(float charge){
  int16_t x = 1, y = 1, w = 30, h = 12;
  int16_t polo_w = 2, polo_h = 4;
  // Draw Battery
  display.drawRect(x, y, w, h, BLACK);
  display.fillRect(x + w, y + polo_h, polo_w, polo_h, BLACK);
  // Draw Charge
  display.fillRect(x, y, w * charge, h, BLACK);
}

but this is the result, I can not color 2/3 of the screen:

The picture on page#1 of the Tutorial PDF has a blue pcb with a square screen approx 1.3 inch diagonal.

Your photo shows a bigger screen with a black pcb similar to the picture on page #12 of your PDF.

I suspect that Adafruit_Learning_System_Guides/SHARP_BadApple/SHARP_BadApple.ino might work on your MEGA2560 if you connect the correct pins.

However there is NO possibility of running CircuitPython on a MEGA2560.
If you are interested in CircuitPython either buy an ESP32 or Metro-M4

I have never used the rectangular Sharp display nor the square display from page #1.

Thank you so much!
I solved it with an ESP32 and followed that tutorial:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.