Hi all!
First time poster here, so I hope I’m ok posting this question.
TLDR:
How to wire and drive two uniquely addressable SSD1306 OLED displays from the Artemis Redboard Nano?
I am trying my hands on creating a fully functional PipBoy from Fallout, and wanted to use the Artemis Nano board for the main brains behind the bells & whistles. You can see my Hackaday.io project [here.
I’ve had some experience programming iPad apps in Objective-C, and I know my way around an IDE.
Dabbling in Code + Electronics is a new venture for me!
I purchased some tiny OLED displays on AliExpress that seem to be of the SSD1306 variety.
I managed to get one of them work on an Arduino Uno with the example sketches for that board (ssd1306_128x32_i2c from Adafruit), however I’m having a hard time figuring out how to hook up these OLED displays to the Artemis Nano board. I know I’ve got to look at I2C ports, and that there’s some IOMasters at play, but I have no idea how I would go about doing that on the Artemis Nano.
If someone who is more adept at the Artemis Nano could help me with the wiring of those two OLEDs and get that sketch to work that would be awesome! I found the I2C Qwiic breakout boards, but that would make the fitting difficult for the PipBoy case, so ideally I’d just wire them up to the Nano board, unless the Qwiic makes handling them easier/more efficient.
The sketch starts with:
This is an example for our Monochrome OLEDs based on SSD1306 drivers
Pick one up today in the adafruit shop!
------> http://www.adafruit.com/category/63_98
This example is for a 128x32 pixel display using I2C to communicate
3 pins are required to interface (two I2C and one reset).
Adafruit invests time and resources providing this open
source code, please support Adafruit and open-source
hardware by purchasing products from Adafruit!
Written by Limor Fried/Ladyada for Adafruit Industries,
with contributions from the open source community.
BSD license, check license.txt for more information
All text above, and the splash screen below must be
included in any redistribution.
**************************************************************************/
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 32 // OLED display height, in pixels
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
#define OLED_RESET 4 // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
When I run the sketch with the Nano board selected, it errors out:
Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.cpp:492:44: error: 'digitalPinToPort' was not declared in this scope
dcPort = (PortReg *)portOutputRegister(digitalPinToPort(dcPin));
Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.cpp:492:44: note: suggested alternative: 'digitalPinToInterrupt'
dcPort = (PortReg *)portOutputRegister(digitalPinToPort(dcPin));
Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.cpp:492:25: error: 'portOutputRegister' was not declared in this scope
dcPort = (PortReg *)portOutputRegister(digitalPinToPort(dcPin));
Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.cpp:493:17: error: 'digitalPinToBitMask' was not declared in this scope
dcPinMask = digitalPinToBitMask(dcPin);
Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.cpp:493:17: note: suggested alternative: 'digitalPinToInterrupt'
dcPinMask = digitalPinToBitMask(dcPin);
exit status 1
Error compiling for board SparkFun RedBoard Artemis Nano.