Pics above if the diagram I have been given and the screen I have, I've worked out the 5v , grd, sda but on my screen I don't have a sck pin.
Can I still use this screen or should I grab a different one, I want the display to be in green
Pics above if the diagram I have been given and the screen I have, I've worked out the 5v , grd, sda but on my screen I don't have a sck pin.
Can I still use this screen or should I grab a different one, I want the display to be in green
SCL is Clock
SDA is Data
The diagram shows sck and sda, it's the sck pin I'm unsure of on this screen
What's the uncertainty?
The display you have in pic 1 is a I2C OLED, while the one showed in pic 2 is a SPI one. Take a look a the difference between these 2 protocols.
PS: The versions of the display in pic2 that are sold here in Brazil operates in 3.3V. Nano is a 5V device. Check your hardware specs if you don´t want to have other problems...
If you google the two types of display you will find connection diagrams for both types , libraries with example code .
Mr Google really is helpful , I answer most questions on here by googling them âŚ.
i've tried google, it gives a solution by changing some lines of code, but the example they give is different to my code lines
AndâŚ..does theirs run ?
You need to post your code , is it something you copied out or did you write it ??
The examples allow you to learn how to use the display .
BTW - thatâs not a green display.
right it was a link i was sent, i've copied the code and pasted it into ide, as far as i'm aware,
theirs works.
/*********************************************************************
Radar-Simulator
Simuliert den Bildschirm eines alten Radargeräts mit einem kreisfÜrmig drehenden Strahl fßr Modellschiffe.
Läuft mit einem 0.96" OLED-Display mit 64x128 Pixeln (solle mit jedem 1306 kompatiblen Display funktionieren)
und einem Arduino Pro Mini (5V, 16 MHz)
Simulates the display of an vintage radar screen with rotating beam for a model ship. Uses 0.96" oled
display with 64x128 pixel and an Arduino pro mini (5V, 16 MHz).
CC-BY SA 2016 Kai Laborenz
*********************************************************************/
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);
#define REFRESH 1 // refresh rate for radar screen (turn speed of line)
#define REFRESH 0 // refresh rate for radar screen (turn speed of line)
// 'Radarscreen' bitmap
const unsigned char backgroundMap [] PROGMEM = {
0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x0c, 0x01, 0x20, 0x80, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x02, 0x1e, 0x00, 0x00, 0x0c, 0x02, 0x20, 0x80, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x1e, 0x9e, 0x00, 0x00, 0x0c, 0x02, 0x21, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0f, 0xde, 0x00, 0x00, 0x0c, 0x02, 0x01, 0x00, 0x30, 0x04, 0x06, 0x00, 0x00, 0x00,
0x00, 0x00, 0x1f, 0xce, 0x00, 0x1c, 0x08, 0x02, 0x02, 0x06, 0x18, 0x03, 0xfe, 0x00, 0x00, 0x00,
0x00, 0x18, 0x0e, 0x0e, 0x00, 0x1e, 0x08, 0x24, 0x02, 0x07, 0x38, 0x00, 0x06, 0x00, 0x00, 0x00,
0x00, 0x0c, 0x02, 0x0e, 0x00, 0x1c, 0x18, 0x34, 0x02, 0x00, 0x70, 0x00, 0x02, 0xc1, 0x00, 0x00,
0x00, 0x06, 0x02, 0x1c, 0x00, 0x1c, 0x18, 0xe4, 0x04, 0x00, 0x30, 0x00, 0x00, 0x63, 0x38, 0x00,
0x00, 0x02, 0x00, 0x08, 0x00, 0x04, 0x10, 0x04, 0x04, 0x00, 0x38, 0x00, 0x00, 0x30, 0x84, 0x00,
0x00, 0x01, 0x00, 0x08, 0x00, 0x00, 0x10, 0x08, 0x24, 0x00, 0x10, 0x00, 0x00, 0x24, 0x04, 0x00,
0x00, 0x01, 0x00, 0x0c, 0x00, 0x00, 0x30, 0x08, 0x04, 0x06, 0x00, 0x00, 0x00, 0x48, 0x04, 0x00,
0x00, 0x01, 0x80, 0x06, 0x00, 0x00, 0x20, 0x08, 0x04, 0x0e, 0x00, 0x00, 0x06, 0x98, 0x00, 0x00,
0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x00, 0x18, 0x00, 0x1c, 0x00, 0x00, 0x01, 0x90, 0x02, 0x00,
0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x80, 0x02, 0x00,
0x00, 0x00, 0x02, 0x06, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0xe0, 0x00, 0x0d, 0xa0, 0x00, 0x00,
0x00, 0x00, 0x07, 0x9e, 0x00, 0x00, 0x00, 0x00, 0x38, 0x01, 0xc0, 0x01, 0x00, 0x60, 0x00, 0x00,
0x00, 0x00, 0x0f, 0xdc, 0x03, 0x03, 0x00, 0x20, 0x00, 0x00, 0x00, 0x0d, 0x80, 0xd0, 0x01, 0x00,
0x00, 0x00, 0x8f, 0xdc, 0x0f, 0x86, 0x00, 0x00, 0x00, 0x00, 0x21, 0x01, 0x80, 0x04, 0x1e, 0x00,
0x00, 0x00, 0x0e, 0xc0, 0x09, 0x8c, 0x03, 0x40, 0x08, 0x00, 0x00, 0x08, 0x00, 0x22, 0x30, 0x00,
0x00, 0x00, 0x01, 0xc0, 0x10, 0x88, 0x03, 0x40, 0x70, 0x01, 0xfd, 0x90, 0x04, 0x00, 0xb0, 0x00,
0x00, 0x00, 0x00, 0x80, 0x00, 0x90, 0x0e, 0x80, 0xe0, 0x07, 0xf0, 0x00, 0x18, 0x00, 0x70, 0x00,
0x00, 0x06, 0x00, 0x00, 0x09, 0xb0, 0x01, 0x0e, 0x40, 0x3c, 0x06, 0x00, 0x18, 0x02, 0x00, 0x00,
0x00, 0x00, 0x00, 0x4e, 0x1f, 0x30, 0x00, 0x18, 0x00, 0x00, 0x04, 0x00, 0x00, 0x06, 0x00, 0x00,
0x18, 0x00, 0x00, 0x7f, 0xf6, 0xb4, 0x38, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x1e, 0x00, 0x00,
0x3e, 0x00, 0x00, 0x3e, 0xc7, 0xad, 0x79, 0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00,
0x32, 0x18, 0x00, 0x00, 0xde, 0x1c, 0x39, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00, 0x10, 0x00, 0x00,
0x00, 0x10, 0x00, 0x01, 0x7c, 0x3c, 0x00, 0x00, 0x00, 0x01, 0xc0, 0x00, 0x00, 0x20, 0x60, 0x00,
0x00, 0x30, 0x80, 0x07, 0x43, 0x00, 0x00, 0x00, 0x06, 0x03, 0xc0, 0x00, 0x00, 0x46, 0x60, 0x00,
0x00, 0xe1, 0x81, 0xfd, 0x50, 0x00, 0x00, 0x00, 0x00, 0x01, 0xc0, 0x00, 0x00, 0x88, 0x80, 0x00,
0x81, 0xe1, 0x87, 0x01, 0x8c, 0x00, 0x00, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00,
0x73, 0xf1, 0x86, 0x08, 0x30, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x60, 0x00,
0x0e, 0x3d, 0x86, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00,
0x0c, 0x18, 0x82, 0x30, 0x00, 0x00, 0x00, 0x20, 0x01, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
0x08, 0x00, 0x46, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x80, 0x20, 0x00, 0x00, 0x00, 0x60, 0x00,
0x08, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x70, 0x00, 0x03, 0x01, 0x40, 0x00,
0x10, 0x00, 0x00, 0x00, 0x01, 0x10, 0x03, 0x00, 0x00, 0x08, 0xc0, 0x00, 0x02, 0x00, 0x80, 0x00,
0x60, 0x03, 0x00, 0x40, 0x01, 0x18, 0x0c, 0x00, 0x00, 0x08, 0x40, 0x00, 0x06, 0x00, 0x40, 0x00,
0x80, 0x01, 0x04, 0x00, 0x01, 0x08, 0x00, 0x00, 0x0c, 0x08, 0x00, 0x04, 0x04, 0x00, 0x20, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x0c, 0x04, 0x00, 0x0e, 0x00, 0x00, 0x20, 0x00,
0x00, 0x00, 0x83, 0x08, 0x01, 0x18, 0x06, 0x00, 0x0c, 0x04, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x00,
0x00, 0x00, 0x10, 0x00, 0x01, 0x08, 0x0c, 0x00, 0x00, 0x32, 0x00, 0x08, 0x00, 0x60, 0x10, 0x00,
0x00, 0x00, 0x60, 0x3c, 0x00, 0x00, 0x08, 0x00, 0x00, 0x63, 0xe0, 0x00, 0x00, 0x60, 0x00, 0x00,
0x00, 0x00, 0x80, 0x00, 0x00, 0x10, 0x00, 0x60, 0x00, 0x00, 0x10, 0x00, 0x00, 0x64, 0x08, 0x00,
0x00, 0x00, 0x04, 0x20, 0x04, 0x01, 0xf0, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x63, 0x06, 0x00,
0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x01, 0xc0, 0x00, 0x00, 0x08, 0xe0, 0x30, 0x63, 0x01, 0x00,
0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x60, 0x03, 0x80, 0x07, 0xf0, 0x08, 0xf6, 0x00, 0x80,
0x80, 0x00, 0x08, 0x0c, 0x11, 0xd0, 0x80, 0x00, 0x00, 0xc0, 0x00, 0x60, 0xe4, 0x01, 0x00, 0x00,
0x00, 0x00, 0x06, 0x18, 0x19, 0x91, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x87, 0x00, 0x40,
0x00, 0x00, 0x3f, 0x18, 0x2c, 0x07, 0x00, 0x00, 0x33, 0x80, 0x00, 0x63, 0x64, 0x53, 0x8c, 0x40,
0xc0, 0x00, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x80, 0x00, 0x70, 0xc2, 0x08, 0x1c, 0x40,
0x40, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xc0, 0x00, 0x20, 0xe2, 0x06, 0x38, 0x20,
0x80, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0c, 0x10, 0x10,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x08,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x0c, 0x06, 0x01, 0x0e, 0x00, 0x04,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x01, 0x0f, 0x00, 0x04,
0x80, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0xc4, 0xc0, 0x04,
0x80, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x80, 0x00, 0x30, 0x24, 0x40, 0x00,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3b, 0xf0, 0x12, 0x20, 0x02,
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x2e, 0x70, 0x0e, 0x20, 0x02,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x74, 0x30, 0x00, 0x20, 0x00,
0x38, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x74, 0x30, 0x00, 0x10, 0x04,
0x1e, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x32, 0x60, 0x00, 0x08, 0x04,
0x0f, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb7, 0xc0, 0x00, 0x38, 0x04,
0x03, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0xc0, 0x00, 0x78, 0xe4
};
#if (SSD1306_LCDHEIGHT != 64)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif
void setup() {
Serial.begin(9600);
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3D (for the 128x64)
// init done
// Clear the buffer.
display.clearDisplay();
display.setRotation(1);
testscrolltext();
display.clearDisplay();
display.setRotation(2);
}
void loop() {
// simulated rotating beam by drawing a line from center to display border
// end point for line is calculated in 4 phases for each side
for(int x = 0; x < 127; x++){
display.drawLine(display.width()/2, display.height()/2, x-1, 0, BLACK);
display.drawLine(display.width()/2, display.height()/2, x, 0, WHITE);
display.drawLine(display.width()/2, display.height()/2, x+1, 0, WHITE);
display.drawBitmap(0, 0, backgroundMap, 128, 64, 1);
drawScreen();
delay(REFRESH);
}
for(int x = 0; x < 63; x++){
display.drawLine(display.width()/2, display.height()/2, 127, x-1, BLACK);
display.drawLine(display.width()/2, display.height()/2, 127, x, WHITE);
display.drawLine(display.width()/2, display.height()/2, 127, x+1, WHITE);
display.drawBitmap(0, 0, backgroundMap, 128, 64, 1);
drawScreen();
delay(REFRESH);
}
for(int x = 127; x > 0; x--){
display.drawLine(display.width()/2, display.height()/2, x+1, 63, BLACK);
display.drawLine(display.width()/2, display.height()/2, x+2, 63, BLACK);
display.drawLine(display.width()/2, display.height()/2, x, 63, WHITE);
display.drawLine(display.width()/2, display.height()/2, x-1, 63, WHITE);
display.drawBitmap(0, 0, backgroundMap, 128, 64, 1);
drawScreen();
delay(REFRESH);
}
for(int x = 63; x > 0; x--){
display.drawLine(display.width()/2, display.height()/2, 0, x+1, BLACK);
display.drawLine(display.width()/2, display.height()/2, 0, x, WHITE);
display.drawLine(display.width()/2, display.height()/2, 0, x-1, WHITE);
display.drawBitmap(0, 0, backgroundMap, 128, 64, 1);
drawScreen();
delay(REFRESH);
}
display.drawLine(display.width()/2, display.height()/2, 0, 1, BLACK); // needed to get rid of some artefact lines
display.drawLine(display.width()/2, display.height()/2, 1, 1, BLACK);
}
void drawScreen(void) {
// draws circles on display
display.fillCircle(display.width()/2, display.height()/2, 2 , WHITE);
display.drawCircle(display.width()/2, display.height()/2, 15, WHITE);
display.drawCircle(display.width()/2, display.height()/2, 30, WHITE);
display.drawCircle(display.width()/2, display.height()/2, 45, WHITE);
display.drawCircle(display.width()/2, display.height()/2, 60, WHITE);
display.display();
}
void testdrawchar(void) {
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0,0);
for (uint8_t i=0; i < 168; i++) {
if (i == '\n') continue;
display.write(i);
if ((i > 0) && (i % 21 == 0))
display.println();
}
display.display();
delay(1);
}
void testscrolltext(void) {
display.setTextSize(2);
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(10,0);
display.setCursor(1,20);
display.clearDisplay();
display.println("scroll");
display.println("Radar");
display.print("startet");
display.display();
delay(800);
display.print(".");
display.display();
delay(800);
display.print(".");
display.display();
delay(800);
display.print(".");
display.display();
delay(1);
display.startscrollright(0x00, 0x0F);
delay(2000);
display.stopscroll();
delay(1000);
display.startscrollleft(0x00, 0x0F);
delay(2000);
display.stopscroll();
delay(1000);
display.startscrolldiagright(0x00, 0x07);
delay(2000);
display.startscrolldiagleft(0x00, 0x07);
delay(2000);
display.stopscroll();
delay(3000);
}
I have merged your cross-posts @Paulcobra.
Cross-posting is against the Arduino forum rules. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend a lot of time investigating and writing a detailed answer on one topic, without knowing that someone else already did the same in the other topic.
It is OK to make separate forum topics for discrete aspects of a project, but you turned each of your topics into a parallel discussion of the compilation error message you are getting.
Repeated cross-posting can result in a suspension from the forum.
In the future, please only create one topic for each distinct subject matter. This is basic forum etiquette, as explained in the "How to get the best out of this forum" guide. It contains a lot of other useful information. Please read it.
Thanks in advance for your cooperation.
This is clearly too complex for me so I'll leave it, please delete this whole thing, I was led to believe it was a simple project, clearly not
The constructor for the Adafruit_SSD-1306 library assumes the display size based on the I2C address of the display. This is not always correct for the generic brand displays many of us use. Adafruit has added a different form of the constructor that allows you to specify the array dimensions, Iâm not where I can look that up on a computer right now, you can either look in the library examples, or there should be a reference webpage for the library if you google it.
That explains alot, someone said I need to remove a line, someone else said I need to change a line, Google said I need to change line 73 to 75 in one of the files, but I checked my file and it was different to the one Google were showing
Who sent you the sketch ?
Someone from this forum, don't worry about it I'm giving it up as a stupid idea now
It is a shame that you are giving up as it sounds interesting
What should the display look like when it is running ? I imagine that it will be a circle with a line along the radius from the centre to the edge of the circle moving around the circle. Is that right ?
Thanks for the picture
That is quite a complicated display. The video seems to show that nothing on the display changes apart from the radius bar sweeping round the circle which makes things simpler
I am sure that the details are somewhere in this topic but please remind me which Arduino board you have and which display you have to avoid me having to search for it
It's an Arduino nano, I've managed to get it running but it's really slow