Things used in this project

Schematics

Hexiwear schematics
HexiWear schematics

Code

Main.cppC/C++
main.cpp mbed code
#include "mbed.h"
#include <SSD1351_SPI.h>
#include <Hexi_Magic.h>
 
//SSD1351_SPI ( mosi, miso, sclk, cs, dc ) ;  
SSD1351_SPI OLED96x96(PTB22,PTB23,PTB21,PTB20,PTD15); 
// Pin connections for Hexiwear
DigitalOut led1(LED1);
DigitalOut led2(LED2);
DigitalOut led3(LED3);
DigitalOut BOOSTEN(PTC13);  //oled power enable
int count = 0;

extern const uint8_t Main_screen_bmp[ 36864 ];
extern const uint8_t smile_bmp[ 36864 ];
extern const uint8_t money_bmp[ 36864 ];
extern const uint8_t brain_bmp[ 36864 ];
int argb = 0xff000000; 
int rgbd = 0x00000000;
int xposg = 0;
int yposg = 0;
void displaybmp(const uint8_t bmpfile[ 36864 ]) {
    count = 0;
    for(int xpos=0;xpos<97;xpos++)
    {
        for(int ypos=0;ypos<96;ypos++)
        {
            rgbd = ((bmpfile[count+3]<<24)|(bmpfile[count]<<16)|(bmpfile[count+1]<<8)|(bmpfile[count+2]));
            OLED96x96.drawPixel(ypos+20,xpos,rgbd);   
            count=count+4; 
        }
    }
}
int main() {
    led1 = 1;
    led2 = 1;
    led3 = 1;
    BOOSTEN = 1;
    OLED96x96.open();
    OLED96x96.state(Display::DISPLAY_ON);
    OLED96x96.fillRect(16,0,111,96,0xff000000);//alpha, BGR
    while (1) 
    {
        displaybmp(Main_screen_bmp);
        Thread::wait(2000);
        displaybmp(smile_bmp); 
        Thread::wait(2000);
        displaybmp(brain_bmp);
        Thread::wait(2000);
        displaybmp(money_bmp);
        Thread::wait(2000);  
    }

}
Hexi_MagicC/C++
Hexi_Magic.bin
No preview (download only).
HexiWear OLED Bitmap ToolC#
HexiWear OLED Bitmap Tool
using System;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApplicationOLED96x96
{
    public partial class Form1 : Form
    {
        String filename1 = string.Empty;
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            String input = string.Empty;
            String tb = string.Empty;
            textBox1.AppendText("Loading Bitmap Image" + Environment.NewLine);
            //pictureBox1.LoadAsync("c:\\image.bmp");
            OpenFileDialog fd = new OpenFileDialog();
            fd.Filter = "bmp files (*.bmp)|*.bmp|All files (*.*)|*.*";
            fd.Title = "Select an image file";
            if (fd.ShowDialog() == DialogResult.OK)
                pictureBox1.LoadAsync(fd.FileName);
            filename1 = fd.FileName;
            textBox1.AppendText("Done" + Environment.NewLine);
            //Save image from PictureBox into MemoryStream object.
            MemoryStream ms = new MemoryStream();
            pictureBox1.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
            //Read from MemoryStream into Byte array.
            Byte[] bytBLOBData = new Byte[ms.Length];
            ms.Position = 0;
            ms.Read(bytBLOBData, 0, Convert.ToInt32(ms.Length));
            string s2 = BitConverter.ToString(bytBLOBData);
            //textBox1.AppendText(s2);
            tb = ms.Length.ToString();
            textBox1.AppendText(" Stream Length(bytes): " + tb + Environment.NewLine);
            tb = pictureBox1.Image.PixelFormat.ToString();
            textBox1.AppendText("  PixelFormat: " + tb + Environment.NewLine);
            button3.Enabled = true;
            toolStripButton2.Enabled = true;
        }
HexiWear OLED Bitmap Tool
HexiWear OLED Bitmap Tool

Credits

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Velo Bling-Bling
Advanced
  • 7,193
  • 149

Full instructions

LED lights for bicycle wheels. 16 multi color LEDs on both PCB sides. Displays images and dynamic info like speed. BLE and USB interface.

DooUcoffee Machine
Advanced
  • 1,554
  • 60

Work in progress

Internet of things in the world of coffee with Udoo - coffee machine 3.0 entirely managed by µController.

DooUcoffee Machine

Team DooUcoffee

FRDM-K82F Camera Based Parking Assistant
Advanced
  • 2,205
  • 33

Full instructions

Use Computer Vision to make a parking assistant that allows you to consistently park a car into your garage with perfect alignment.

Directional Motion-Detecting USB Web Cam Using a FRDM-K82F
Advanced
  • 2,422
  • 37

Full instructions

Use simple image processing and an image sensor to detect whether a person enters or leaves a room.

Apollo Guidance Computer Interface for Inertial Navigation
Advanced
  • 829
  • 17

A restructured approach to implementing the elegant Apollo DSKY interface for a digital inertial navigation and guidance system.

RFID Register
Advanced
  • 13,734
  • 57

Work in progress

Clock in and out of locations with Mifare RFID cards for an accurate register of movements on and off site locations.

RFID Register

Team Homeworld

ProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login
Feedback