The following table display on which pins the SPI lines are broken out on the different Arduino boards:
Arduino Board MOSI MISO SCK SS (slave) SS (master)
Mega1280
Mega2560 51 or 50 or 52 or 53
ICSP-4 ICSP-1 ICSP-3
Note that MISO, MOSI, and SCK are available in a consistent physical location on the ICSP header; this is useful, for example, in designing a shield that works on every board.
Sunlolo:
Hic hic anyone know what is DC pin ?? i know CS is SS but DC is what, and where it conects to in ardruino Mega =(
If you've got the SSD1306 controller (I guess as I see in your sample code) the DC pin does the following:
This is Data/Command control pin. When it is pulled HIGH (i.e. connect to VDD), the data at D[7:0] is treated as data. When it is pulled LOW, the data at D[7:0] will be transferred to the command register.
In I2C mode, this pin acts as SA0 for slave address selection.
When 3-wire serial interface is selected, this pin must be connected to VSS.
Arduino Mega 2560 e Mega ADK:
To connect the lcd screen to a Mega board, use this pin configuration:
+5V: +5V
MISO: 50 on Mega 2560 (Miso on ADK)
SCK: 52 on Mega 2560 (Sck on ADK)
MOSI: 51 on Mega 2560 (Mosi on ADK)
LCD CS: pin 10
SD CS: pin 4
D/C: pin 9
RESET: pin 8
BL: +5V
GND: GND
I have a Mega adruino , and a oled screen like this
Do not show a picture which is like your screen. Provide a picture of your screen together with the correct datasheet. Anything else is guessing. It seems that you have used some pictures from/for Adafruit Displays. Is your OLED an Adafruit OLED? If not, then the Adafruit software might not work at all (the Adafruit library only supports SSD1306, but not the SH1106 controller).
Regarding the connection: My suggestion is to use the 4-wire SPI, because 3-wire SPI is usually not implemented by the Arduino libraries and I2C is unreliable for far east variants of this OLED with the SSD1306 controller.
For 4-wire SPI:
The display does not have a MISO output
DC is data/command line, which is required in 4-wire SPI mode
CS, MOSI and CLK are the other 3 lines required for 4-wire SPI mode.
olikraus:
Is your OLED an Adafruit OLED? If not, then the Adafruit software might not work at all (the Adafruit library only supports SSD1306, but not the SH1106 controller).
The display does not have a MISO output
DC is data/command line, which is required in 4-wire SPI mode
CS, MOSI and CLK are the other 3 lines required for 4-wire SPI mode.
Thanks for your help bro, im sure that screen have ssd1306 controller, and i have its datasheet
but my problem is i cant find where pin to tonect in my case using mega, its defferent with the tuts using uno on web:((
This depends on the library. U8glib has as SW SPI included, so you can use any digital or analog Arduino pin for any of the display pins. Just inform U8glib which pins you actually use.