Just doing a bit of mucking around 
The examples it comes with are OK - but I wanted an Arduino version of MSpaint, so 2 hours of coding later, here we go
Very basic functionality, keys 1-9 select colour, mouse wheel changes brush size, and rightclick clears the display, but it's fun to mess around with
Here's the code if anyone else has one & wants to give it a shot. It could probably be easily adapted to any other module or graphic LCD too.
Arduino code:
Processing code (only works in the x86 version):


The examples it comes with are OK - but I wanted an Arduino version of MSpaint, so 2 hours of coding later, here we go


Very basic functionality, keys 1-9 select colour, mouse wheel changes brush size, and rightclick clears the display, but it's fun to mess around with

Here's the code if anyone else has one & wants to give it a shot. It could probably be easily adapted to any other module or graphic LCD too.
Arduino code:
Code:
#include <SPI.h>
#include <SD.h>
#include <FTOLED.h>
const byte pin_cs = 7;
const byte pin_dc = 2;
const byte pin_reset = 3;
String serial_data[4]; // String for incoming serial data
int varcounter = 0; // For storing serial to array
Colour drawCol;
OLED oled(pin_cs, pin_dc, pin_reset);
void setup()
{
Serial.begin(115200);
oled.begin();
}
void loop() {
if (Serial.available() > 0){
int nnn;
delay(10);
while (Serial.available() > 0) {
char c = Serial.read();
if (c == 'c'){
oled.clearScreen();
serial_data[2] = "1";
}
if (c == ',') {
varcounter++;
}
if (c != ',' && c != '.'){
serial_data[varcounter] += c;
}
if (c == '.'){
for (int i = 0; i<4; i++)
serial_data[i] = "";
varcounter = 0;
}
}
switch (serial_data[2].toInt()){
case 1:
drawCol = BLACK;
break;
case 2:
drawCol = WHITE;
break;
case 3:
drawCol = RED;
break;
case 4:
drawCol = GREEN;
break;
case 5:
drawCol = BLUE;
break;
case 6:
drawCol = YELLOW;
break;
case 7:
drawCol = CYAN;
break;
case 8:
drawCol = MAGENTA;
break;
case 9:
drawCol = LIGHTBLUE;
break;
}
oled.drawFilledCircle(serial_data[0].toInt(),map(serial_data[1].toInt(),0,127,127,0),serial_data[3].toInt(),drawCol);
}
}
Processing code (only works in the x86 version):
Code:
import processing.serial.*;
Serial port;
color drawcol = color(255,255,255);
char colKey = '2';
float wheel = 1.0;
void setup() {
size(168, 128);
frameRate(140);
background(0,0,0);
println("Available serial ports:");
println(Serial.list());
port = new Serial(this, "COM12", 115200);
}
void draw() {
stroke(255);
line(128,0,128,128);
if (keyPressed){
colKey = key;
switch(key){
case '1':
drawcol = color(0,0,0);
break;
case '2':
drawcol = color(255,255,255);
break;
case '3':
drawcol = color(255,0,0);
break;
case '4':
drawcol = color(0,255,0);
break;
case '5':
drawcol = color(0,0,255);
break;
case '6':
drawcol = color(255,255,0);
break;
case '7':
drawcol = color(0,255,255);
break;
case '8':
drawcol = color(216,191,216);
break;
case '9':
drawcol = color(175,238,238);
break;
}
}
if (mousePressed == true){
if (mouseButton == RIGHT){
port.write("c");
background(0,0,0);
} else{
port.write("." + constrain(mouseX,0,127) + "," + constrain(mouseY,0,127) + "," + colKey + "," + int(wheel));
noStroke();
fill(drawcol);
ellipse(constrain(mouseX,0,127),constrain(mouseY,0,127),int(wheel) * 2,int(wheel) * 2);
}
}
noStroke();
fill(0);
rect(129,0,39,128);
fill(drawcol);
ellipse(148,20,int(wheel) * 2,int(wheel) * 2);
}
void mouseWheel(MouseEvent event) {
wheel = constrain(wheel + event.getAmount(),1,12);
println(int(wheel));
}
Last edited: