MicroBob
Published © GPL3+

InVyu: The Maker's Wearable Heads-Up Display

Your way to bring what you need IN VIEW.

AdvancedFull instructions provided2 hours1,006

Things used in this project

Hardware components

MAX32620FTHR
Maxim Integrated MAX32620FTHR
×1
Parallax MEMSIC 2125 Dual-axis Accelerometer (Mx2125)
×1
128x64 Monochrome I2C OLED
Just go to amazon.com and search for "128x64 I2C OLED" and you will be flooded with results that look exactly like this one. It is very important that you buy the I2C variant (which uses four pins). Use the link to store button to see the version I used.
×2
25mm Bi-Convex lenses
Just look "Bi-Convex lenses" on Amazon. The type used in this project are 25mm in diameter and have a focal length of 40mm. Use the link to store button to see the version I used.
×1
HM-10 BLE Module
Find any HM-10 Module you like, as long as it has Power, GND, TX, and RX. There are known to fakes of the HM-10 on the market, so please shop with care. Use the link to store button to see the version I used.
×1
Micro-USB to USB Cable (Generic)
Micro-USB to USB Cable (Generic)
For programming
×2
Female/Female Jumper Wires
Female/Female Jumper Wires
For both OLEDs, the HM-10, and the Mx2125
×17
Male/Male Jumper Wires
×17
Li-Ion Battery 1000mAh
Li-Ion Battery 1000mAh
Any 3.3v battery that can connect to the battery port on the MAX32620FTHR
×1
Wood Glue
Any generic wood glue would work, as long as it can firmly hold together pieces of laser cut wood
×1

Software apps and online services

Fusion 360
Autodesk Fusion 360
For designing the case
Arm Mbed Mbed Compiler / CLI
For programming the MAX32620FTHR
Xcode
Apple Xcode
Maker service
IFTTT Maker service

Hand tools and fabrication machines

Laser cutter (generic)
Laser cutter (generic)
Cut 1/8in (3.175mm) wood to make the case
Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Custom parts and enclosures

Case.dxf

DXF file for the laser cutter. USE 1/8in (3.175mm) WOOD THICKNESS!!!

Case.f3d

Fusion 360 file of the case for your CAD hacking desires :-)

Schematics

Circuit

Breadboard view of the wiring
Invyu bb 4iqcm1g5m3

MAX32620FTHR Fritzing part

Made by me! Same part used the Circuit diagram. Do know that it was drawn as a standalone part, so it doesn't really fit on breadboards.

Mx2125 Fritzing Part

Made by me! Same part used the Circuit diagram. Do know that it was drawn as a standalone part, so it doesn't really fit on breadboards.

Code

main.cpp

C/C++
Firmware code
#include "mbed.h"
#include "Adafruit_SSD1306.h"
#include "Pulse.h"
#include "MAX17055.h"

//inits
I2C i2c(P1_6, P1_7);
Adafruit_SSD1306_I2c oled(i2c, P2_7);
PulseInOut xax(P5_7);
PulseInOut yax(P6_0);
Serial sr(P3_1, P3_0);
I2C bati(P3_4, P3_5);
MAX17055 bat(bati);


const unsigned char clear []  = {
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x18, 0xf8, 0x30, 0x90, 0xd0, 0xc0, 0xec, 0xef, 0xef, 0xec, 0xe0, 0xd0,
	0x90, 0x30, 0x78, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x1e, 0x1e, 0x80, 0x3e, 0x7f,
	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x3f, 0x80, 0x1e, 0x1e, 0x0c, 0x0c, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x06, 0x07, 0x07, 0x02, 0x00, 0x00, 0x0d, 0x3d, 0x3d, 0x0d, 0x01, 0x00,
	0x02, 0x03, 0x07, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
const unsigned char clouds [] = {
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xe0, 0xe0,
	0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xe0, 0xe0, 0xc0, 0x80, 0x00, 0x00, 0xe0, 0xf8, 0xfc, 0xfc, 0xfe,
	0xfe, 0xfc, 0xfc, 0xf8, 0xf0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00,
	0xe0, 0xf0, 0xf8, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
	0xff, 0xff, 0xfe, 0xfe, 0xfe, 0xfe, 0xfc, 0xf9, 0xf3, 0xc7, 0xdf, 0xdf, 0xdf, 0x1f, 0x7f, 0x7f,
	0x7f, 0x7f, 0x7f, 0x7f, 0x7e, 0x7e, 0x7e, 0x3c, 0x0f, 0x1f, 0x3f, 0x3f, 0x3f, 0x7f, 0x7f, 0x7f,
	0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f,
	0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x3f, 0x1f, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
const unsigned char fewClouds [] = {
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xe0,
	0xe0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xe0, 0xe0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x10, 0xf0,
	0xe0, 0xc0, 0x80, 0xf0, 0xfc, 0xfc, 0xf0, 0x80, 0xc0, 0xe0, 0xf0, 0x10, 0x00, 0x00, 0x00, 0x00,
	0x00, 0xe0, 0xf0, 0xf8, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfc, 0xf9, 0x83, 0xbf, 0xbf, 0xbf, 0xbf, 0x3f,
	0x7f, 0x7f, 0xbe, 0x0e, 0x0c, 0x04, 0x00, 0x00, 0x01, 0x0f, 0x1f, 0x3f, 0x3f, 0x3f, 0x7f, 0x7f,
	0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f,
	0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x3f, 0x3f, 0x1f, 0x0e, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
const unsigned char snow [] = {
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xc0, 0x80, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x18,
	0x38, 0x70, 0xe0, 0xff, 0xff, 0xe0, 0x70, 0x38, 0x18, 0x00, 0x00, 0xe0, 0xc0, 0x00, 0x00, 0x80,
	0xc0, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x08, 0x18, 0x18,
	0x19, 0x1b, 0x1e, 0x1c, 0x3f, 0x70, 0xe0, 0xc0, 0x8c, 0x1c, 0x38, 0xff, 0xff, 0x38, 0x1c, 0x8c,
	0xc0, 0xe0, 0x70, 0x3f, 0x1f, 0x1e, 0x1b, 0x19, 0x18, 0x18, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00,
	0x18, 0x18, 0x18, 0x99, 0xdb, 0xff, 0x7e, 0x3c, 0x18, 0x18, 0xdb, 0x7f, 0x3e, 0x18, 0x18, 0x19,
	0xdb, 0xff, 0x7e, 0xff, 0xff, 0x7e, 0xff, 0xdb, 0x99, 0x18, 0x3c, 0x7e, 0xff, 0xdb, 0x18, 0x18,
	0x3c, 0x7e, 0xff, 0x9b, 0x19, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x18, 0x18,
	0x98, 0xd8, 0x78, 0x78, 0xf8, 0x0c, 0x06, 0x03, 0x31, 0x30, 0x18, 0xff, 0xff, 0x18, 0x38, 0x31,
	0x03, 0x07, 0x0e, 0xf8, 0x78, 0x78, 0xd8, 0x98, 0x18, 0x18, 0x10, 0x01, 0x01, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x03, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x18,
	0x1c, 0x0e, 0x07, 0xff, 0xff, 0x07, 0x0e, 0x1c, 0x18, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01,
	0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
const unsigned char mist [] = {
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x18, 0x18, 0x1c, 0x9c, 0x8c,
	0x8c, 0x8c, 0x8e, 0x8e, 0x8e, 0x8c, 0x8c, 0x9c, 0x1c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1c, 0x9c,
	0x8c, 0x8c, 0x8e, 0x8e, 0x8e, 0x8c, 0x8c, 0x8c, 0x9c, 0x1c, 0x18, 0x18, 0x10, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x82, 0xc7, 0xc7, 0xe3, 0xe3, 0x63, 0x63, 0x71, 0x71, 0x71, 0x71, 0x71, 0x63, 0xe3,
	0xe3, 0xc7, 0xc7, 0xc7, 0xc7, 0xc7, 0xe3, 0xe3, 0x63, 0x71, 0x71, 0x71, 0x71, 0x71, 0x63, 0x63,
	0xe3, 0xe3, 0xc7, 0xc7, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x18, 0x18, 0x1c, 0x1c,
	0x1c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x1c, 0x1c, 0x18, 0x18, 0x38, 0x38, 0x38, 0x18, 0x18, 0x1c,
	0x1c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x1c, 0x1c, 0x1c, 0x18, 0x18, 0x38, 0x10, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
const unsigned char rain [] ={
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xc0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0,
	0xc0, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x20, 0xe0, 0xc0, 0x80, 0x00, 0xe0, 0xf8, 0xf8, 0xe0,
	0x00, 0x80, 0xc0, 0xe0, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xe0, 0xf0, 0xf0, 0xfe, 0xff,
	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
	0xfd, 0xf9, 0xf3, 0x07, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0xff, 0xff, 0x7d, 0x1c, 0x18, 0x08, 0x00,
	0x00, 0x02, 0x1f, 0x3f, 0x7f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
	0x7e, 0x3e, 0x1c, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0,
	0xe0, 0xf0, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x7c, 0x7e, 0x7c, 0x00, 0x00, 0x00, 0x00,
	0x1e, 0x1f, 0x1f, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
const unsigned char shower []= {
	0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xc0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xc0, 0xc0, 0x80,
	0x00, 0x00, 0x00, 0xc0, 0xf0, 0xf8, 0xf8, 0xfc, 0xfc, 0xf8, 0xf8, 0xf0, 0xe0, 0xc0, 0xc0, 0xc0,
	0xc0, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xe0, 0xf0, 0xf0, 0xfe, 0xff, 0xff, 0xff,
	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfc, 0xfd, 0xfd, 0xfd, 0xf9, 0xf3,
	0xe7, 0x8f, 0xbf, 0xbf, 0xbf, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfc, 0xfc, 0xfc, 0x78,
	0x1f, 0x3f, 0x7f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfe, 0x1c,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0xc0, 0xe0, 0xf0, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x7c, 0x7e, 0x7c, 0x00, 0x00,
	0x00, 0x00, 0x1e, 0x1f, 0x1f, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
const unsigned char scatClouds [] = {
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0,
	0xe0, 0xf0, 0xf8, 0xf8, 0xfc, 0xfc, 0xfc, 0xfc, 0xf8, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, 0x80, 0x80,
	0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x40, 0xf8, 0xfc, 0xfc, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xf0, 0xf0, 0xf0,
	0xf0, 0xe0, 0xe0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x07, 0x0f, 0x0f, 0x0f,
	0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f,
	0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x0f, 0x0f, 0x0f, 0x03, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
const unsigned char thunder [] = {
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x80, 0x00,
	0x00, 0x00, 0x00, 0x00, 0xc0, 0xe0, 0xf0, 0xf0, 0xf8, 0xf8, 0xf0, 0xf0, 0xe0, 0xc0, 0x80, 0x80,
	0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0xe0, 0xfc, 0xff, 0xff, 0xff,
	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xf8, 0xfd, 0xfd, 0xf9, 0xfb, 0xf3,
	0xf7, 0xc7, 0x1f, 0x7f, 0x7f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xf8, 0xf8, 0xf8,
	0x3f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x07, 0x03, 0x83, 0xc3, 0xe3, 0xf3,
	0xfb, 0xff, 0xff, 0xff, 0x3f, 0x0f, 0x0f, 0x8f, 0xcf, 0xef, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x7e,
	0x3c, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x13,
	0x10, 0xc8, 0x78, 0x82, 0x63, 0x3a, 0x0a, 0x06, 0x00, 0x08, 0x8f, 0x68, 0x38, 0xc0, 0x33, 0x1b,
	0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x0b, 0x0c, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x03, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};




int main(int argc, char const *argv[]) {
    // Setup
    oled.clearDisplay();
    oled.setTextCursor(0, 0);
    oled.display();

    set_time(0);

    int status;
    float f_value;
    bat.init(0.05f);
    bat.status(&status);

    sr.baud(9600);
    while (!sr.writeable()) { }

    // Loop
    while (true) {
        //update data
        int x = ((xax.read_high_us() / 10) - 500) * 8;
        int y = ((yax.read_high_us() / 10) - 500) * 8;
        time_t sec = time(NULL);

        // time and battery
        oled.setTextCursor(0, 0);
		oled.setTextSize(1);
        char buffer[32];
        strftime(buffer, 32, "%I:%M %p\n", localtime(&sec));
        oled.printf("    %s\r", buffer);
        oled.printf("Bat Status: %04X\n\r", (uint16_t)status);
        bat.v_cell(&f_value);
        oled.printf("Battery: %6.3fV\n\r", f_value );
        oled.display();


        //BLE check and update data
        if (sr.readable()) {
            int in = sr.getc();

            switch (in) {
                case 84: {// 'T': incoming set time
                    unsigned long int inTime = 0;
                    char input[10];
                    sr.putc(84);
                    while (true) {
                        if (sr.readable()) {
                            sr.gets(input, 11);
                            break;
                        }
                    }
                    inTime = strtoul(input, NULL, 10);
                    set_time(inTime);
                }break;
                case 88:
                    oled.printf("An error occurred!\nPlease open the InVyu Activities app for more information\r\n");
                    oled.display();
                    wait(10);
                    break;
				case 67:
					char cust[160];
					sr.putc(99);

					oled.clearDisplay();
					oled.setTextCursor(0,0);
					oled.printf("Gathering\r");
					oled.display();

					while (true) {
                        if (sr.readable()) {
                            sr.gets(cust, 161);
                            break;
                        }
                    }

					oled.clearDisplay();
					oled.setTextCursor(0,0);
					oled.printf("%s\n", cust);
					oled.display();
					while (true) {
						if (y > 650) {
							bool cancel = false;
							for (int l = 0; l < 3; l++) {
								oled.clearDisplay();
								oled.setTextCursor(0, 64/3);
								oled.setTextSize(2);
								oled.printf("Hold to Exit\r");
								oled.setTextSize(1);
								oled.display();
								wait(1);
						        x = ((xax.read_high_us() / 10) - 500) * 8;
								if (x < 650) {
									cancel = true;
									break;
								}
							}

							if (cancel) {
								oled.clearDisplay();
								break;
							}
						}
					}
					break;
                default:
                    oled.printf("Unknown: %d\r", in);
                    oled.display();
					oled.clearDisplay();
                    break;
            }
        }

        if (x > 650) { // Weather gesture
            char *tempInput;
            int id;
            char *descInput;

            sr.putc(87);
            while (true) {
                if (sr.readable()) {
                    sr.scanf("%s\n", tempInput);
                    break;
                }
            }
            sr.putc(119);
            while (true) {
                if (sr.readable()) {
                    id = sr.getc();
                    break;
                }
            }
            sr.putc(100);
            while (true) {
                if (sr.readable()) {
                    sr.scanf("%s\n", descInput);
                    break;
                }
            }

            oled.clearDisplay();

			switch (id) {
				case 2:
	                oled.drawBitmap(0,0,thunder, 40,40, WHITE);
					break;
				case 3:
	                oled.drawBitmap(0,0,rain, 40,40, WHITE);
					break;
				case 5:
					if (strcmp(descInput, "heavy intensity rain") == 0 || strcmp(descInput, "very heavy rain") == 0 || strcmp(descInput, "extreme rain") == 0 || strcmp(descInput, "shower rain") == 0 || strcmp(descInput, "heavy intensity shower rain") == 0) {
						oled.drawBitmap(0,0,shower, 40,40, WHITE);
					} else {
						oled.drawBitmap(0,0,rain, 40,40, WHITE);
					}
					break;
				case 6:
	                oled.drawBitmap(0,0,snow, 40,40, WHITE);
					break;
				case 7:
	                oled.drawBitmap(0,0,mist, 40,40, WHITE);
					break;
				case 8:
					if (strcmp(descInput, "clear sky") == 0) {
		                oled.drawBitmap(0,0,clear, 40,40, WHITE);
					} else if (strcmp(descInput, "few clouds") == 0) {
						oled.drawBitmap(0,0,fewClouds, 40,40, WHITE);
					} else if (strcmp(descInput, "scattered clouds") == 0) {
						oled.drawBitmap(0,0,scatClouds, 40,40, WHITE);
					} else {
						oled.drawBitmap(0,0,clouds, 40,40, WHITE);
					}
					break;
				default:
					oled.drawBitmap(0,0,fewClouds, 40, 40, WHITE);
					break;
			}
            oled.setTextCursor(128/2, 20);
            oled.setTextSize(2);
            oled.printf("%s\r", tempInput);
            oled.setTextSize(1);
            oled.setTextCursor(0, 45);
            oled.printf("%s\r", descInput);
            oled.display();

			wait(5);
			oled.clearDisplay();
        } else if (x < -500) {
			oled.clearDisplay();
			bool cancel = false;
			for (int l=0; l<3; l++) {
				if (x < -500) {
					oled.setTextCursor(0, 64/3);
					oled.printf("Hold for 3 seconds to trigger IFTTT down gesture\r");
					oled.display();
					wait(1);
			        x = ((xax.read_high_us() / 10) - 500) * 8;
				} else {
					cancel = true;
					break;
				}
			}

			oled.clearDisplay();
			if (cancel) {
				oled.setTextCursor(0, 64/3);
				oled.setTextSize(2);
				oled.printf("Canceled\r");
				oled.setTextSize(1);
				oled.display();
				wait(2);
			} else {
				sr.putc(68);
				oled.setTextCursor(0, 64/3);
				oled.setTextSize(2);
				oled.printf("Sent!\r");
				oled.setTextSize(1);
				oled.display();
				wait(2);
			}
			oled.clearDisplay();
		} else if (y < -500) {
			oled.clearDisplay();
			bool cancel = false;
			for (int l=0; l<3; l++) {
				if (y < -500) {
					oled.setTextCursor(0, 64/3);
					oled.printf("Hold for 3 seconds to trigger IFTTT left gesture\r");
					oled.display();
					wait(1);
			        y = ((yax.read_high_us() / 10) - 500) * 8;
				} else {
					cancel = true;
					break;
				}
			}

			oled.clearDisplay();
			if (cancel) {
				oled.setTextCursor(0, 64/3);
				oled.setTextSize(2);
				oled.printf("Canceled\r");
				oled.setTextSize(1);
				oled.display();
				wait(2);
			} else {
				sr.putc(108);
				oled.setTextCursor(0, 64/3);
				oled.setTextSize(2);
				oled.printf("Sent!\r");
				oled.setTextSize(1);
				oled.display();
				wait(2);
			}
			oled.clearDisplay();
		} else if (y > 500) {
			oled.clearDisplay();
			bool cancel = false;
			for (int l=0; l<3; l++) {
				if (y > 500) {
					oled.setTextCursor(0, 64/3);
					oled.printf("Hold for 3 seconds to trigger IFTTT right gesture\r");
					oled.display();
					wait(1);
			        y = ((yax.read_high_us() / 10) - 500) * 8;
				} else {
					cancel = true;
					break;
				}
			}

			oled.clearDisplay();
			if (cancel) {
				oled.setTextCursor(0, 64/3);
				oled.setTextSize(2);
				oled.printf("Canceled\r");
				oled.setTextSize(1);
				oled.display();
				wait(2);
			} else {
				sr.putc(114);
				oled.setTextCursor(0, 64/3);
				oled.setTextSize(2);
				oled.printf("Sent!\r");
				oled.setTextSize(1);
				oled.display();
				wait(2);
			}
			oled.clearDisplay();
		}

        wait(1);
    }
    return 0;
}

InVyu_Firmware.bin

C/C++
.bin file for those of us who don't want to compile firmware from scratch.
No preview (download only).

InVyu Activities

Swift
Zipped Xcode project
No preview (download only).

Credits

MicroBob

MicroBob

8 projects • 51 followers
DIY technology hobbyist

Comments