After much head scratching and lot of google'ing I finally got the OLED screen on the chipKIT IO Shield to turn on. Here's the proof:
Please join me in the most triumphant achievement. I think I deserve a cuppa and a biscuit(if I can find some).
Here is the code that I used to get the OI shield to display, it's a mashup of the demo script and the usual Arduino button script. So if you switch the sliding switch at pin 2 on, the OLED screen turns on, switch it again it goes off.
A few prerequisites, when you download the OLED demo from the Max32 website the example code is in a different folder to the files required so make sure you copy all these over to the same directory (it's one those silly little things that gets you scratching your head, for ages going "but it's right, just work"):
- ChrFont0.c
- delay.c
- delay.h
- FillPat.c
- IOSheildOled.cpp
- IOShieldOled.h
- OledChar.c
- OledChar.h
- OLedDriver.c
- OledDriver.h
- OledGrph.c
- OledGrph.h
<-------Code Start--------->
#include <IOShieldOled.h>
const int buttonPin = 2;
int buttonState = 0;
void setup()
{
IOShieldOled.begin();
pinMode(buttonPin, INPUT);
}
void loop()
{
int irow;
int ib;
//Clear the virtual buffer
IOShieldOled.clearBuffer();
//Chosing Fill pattern 0
IOShieldOled.setFillPattern(IOShieldOled.getStdPattern(0));
//Turn automatic updating off
IOShieldOled.setCharUpdate(0);
buttonState = digitalRead(buttonPin);
// check if the pushbutton is pressed.
// if it is, the buttonState is HIGH:
if (buttonState == HIGH) {
// turn LED on:
IOShieldOled.displayOn();
}
else {
// turn LED off:
IOShieldOled.displayOff();
}
for (irow = 0; irow < IOShieldOled.rowMax; irow++)
{
IOShieldOled.clearBuffer();
IOShieldOled.setCursor(0, 0);
IOShieldOled.putString("element14.com");
IOShieldOled.setCursor(0, 1);
IOShieldOled.putString("Community");
IOShieldOled.setCursor(0, 2);
IOShieldOled.putString("by PK");
IOShieldOled.setCursor(0, 3);
IOShieldOled.putString("Not bad eh!");
IOShieldOled.updateDisplay();
delay(100);
}
delay(100);
}
<------------Code End--------------->
Hopefully, I'll post a more in depth review on this great piece of kit in the next few 'bits' of time.
All the best
Pat