Hardware:
Using the Digole Library everthing works perfectly however I am forced to use 24MHz clock speed which I would rather not do.
I believe this is a case of newb programmer missing something important, so please enlighten me as to why the following code will not work:
- Teensy 3.1
- Digole True Color OLED 96x64 http://www.digole.com/index.php?productID=882
- Wired as per defaults with SS on pin 10
Using the Digole Library everthing works perfectly however I am forced to use 24MHz clock speed which I would rather not do.
I believe this is a case of newb programmer missing something important, so please enlighten me as to why the following code will not work:
Code:
#include <SPI.h> // include the SPI library:
const int slaveSelectPin = 10;
SPISettings settingsA(1600000, MSBFIRST, SPI_MODE1);
void setup() {
// set the slaveSelectPin as an output:
pinMode (slaveSelectPin, OUTPUT);
// initialize SPI:
SPI.begin();
delay(10); //waiting for display model ready
ClearScreen();
}
void loop(){
WriteChar('5');
delay(1000);
}
void ClearScreen(){
SPI.beginTransaction(settingsA);
digitalWrite(slaveSelectPin,LOW);
// send in the address and value via SPI:
SPI.transfer('C');
SPI.transfer('L');
// take the SS pin high to de-select the chip:
digitalWrite(slaveSelectPin,HIGH);
SPI.endTransaction();
}
void WriteChar(int integer){
SPI.beginTransaction(settingsA);
digitalWrite(slaveSelectPin,LOW);
// send in the address and value via SPI:
SPI.transfer('TT');
SPI.transfer(integer);
// take the SS pin high to de-select the chip:
digitalWrite(slaveSelectPin,HIGH);
SPI.endTransaction();
}
Last edited: