#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
#define OLED_RESET 4 // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
const char* Version = "v2.3";
//Constants
const int screenPin = 4;
const int modePin = 2;
int screenState = 1;
int modeState = 1;
int buttonState = 0;
// this is the bitmap, change this variable for your specification.
const unsigned char Gear [] PROGMEM = {
// 'Gear_bitmap_V5, 62x62px
0x00, 0x00, 0x00, 0x0f, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xc0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x1f, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xe0, 0x00, 0x00, 0x00,
0x00, 0x01, 0xc0, 0x1f, 0xe0, 0x0e, 0x00, 0x00, 0x00, 0x03, 0xe0, 0x1f, 0xe0, 0x1f, 0x00, 0x00,
0x00, 0x0f, 0xf0, 0x7f, 0xf8, 0x3f, 0xc0, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00,
0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00,
0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00, 0x00, 0x03, 0xff, 0xff, 0xc0, 0xff, 0x00, 0x00,
0x00, 0x03, 0xff, 0xf8, 0x0c, 0xff, 0x00, 0x00, 0x00, 0x07, 0xff, 0x01, 0xfc, 0xff, 0x80, 0x00,
0x00, 0x0f, 0xf8, 0x3f, 0xfe, 0x3f, 0xc0, 0x00, 0x00, 0x1f, 0xe3, 0xff, 0xff, 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b, 0xdf, 0xf0, 0x01, 0xe7, 0x78, 0xff, 0xfc, 0xfb, 0xde, 0x00,
0x00, 0xe7, 0x7f, 0xff, 0xff, 0xfb, 0x9c, 0x00, 0x00, 0xf3, 0x78, 0xf3, 0x3d, 0x73, 0x3c, 0x00,
0x00, 0x78, 0x3b, 0xff, 0xff, 0xb0, 0x78, 0x00, 0x00, 0x7f, 0x3b, 0xf3, 0x9f, 0x37, 0xf8, 0x00,
0x00, 0x7f, 0x99, 0xc7, 0xc0, 0x67, 0xf8, 0x00, 0x00, 0xff, 0xce, 0x1f, 0xf3, 0xcf, 0xfc, 0x00,
0x01, 0xff, 0xe7, 0xff, 0xff, 0xdf, 0xfe, 0x00, 0x01, 0xff, 0xf3, 0xff, 0xff, 0xbf, 0xfe, 0x00,
0x03, 0xff, 0xf9, 0xff, 0xfe, 0x7f, 0xff, 0x00, 0x03, 0xff, 0xfc, 0x7f, 0xf8, 0xff, 0xff, 0x00,
0x01, 0xff, 0xff, 0x0f, 0xe3, 0xff, 0xfe, 0x00, 0x00, 0xf8, 0x7f, 0xc0, 0x0f, 0xf8, 0x7c, 0x00,
0x00, 0x70, 0x3f, 0xff, 0xff, 0xf0, 0x38, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xe0, 0x00, 0x00,
0x00, 0x00, 0x0f, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xc0, 0x00, 0x00,
0x00, 0x00, 0x0f, 0xf0, 0x3f, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xe0, 0x1f, 0xe0, 0x00, 0x00,
0x00, 0x00, 0x1f, 0xe0, 0x1f, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xc0, 0x0f, 0xc0, 0x00, 0x00,
0x00, 0x00, 0x03, 0xc0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
// SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3D)) { // Address 0x3D for 128x64
Serial.println(F("SSD1306 allocation failed"));
for(;;); // Don't proceed, loop forever
}
// Show initial display buffer contents on the screen --
// the library initializes this with an Adafruit splash screen.
//display.display();
//delay(2000); // Pause for 2 seconds
// Clear the buffer
display.clearDisplay();
pinMode(screenPin, INPUT_PULLUP);
pinMode(modePin, INPUT_PULLUP);
}
void loop() {
int screenState = digitalRead(screenPin);
int modeState = digitalRead(modePin);
//print out the value of the pushbutton
Serial.println(screenState);
Serial.println(modeState);
if (screenState == HIGH && buttonState == 0){
display.clearDisplay();
display.drawBitmap(0, 0, Gear, 62, 62, WHITE);
display.setTextColor(WHITE);
display.setTextSize(1);
display.setCursor(70,6);
display.print("SPECTRUM");
display.setTextSize(1);
display.setCursor(74,28);
display.print(Version);
display.setTextSize(1);
display.setCursor(70,50);
display.print("IS ONLINE");
display.display();
delay(1000);}
if (screenState == LOW && buttonState == 0){
display.clearDisplay();
display.setTextColor(WHITE);
// Network ssid
display.setTextSize(1);
display.setCursor(0,4);
display.print("SSID =");
display.setTextSize(1);
display.setCursor(56,4);
display.print("GiGaBiT-2.4");
//Ip Address
display.setTextSize(1);
display.setCursor(0,20);
display.print("IP =");
display.setTextSize(1);
display.setCursor(56,20);
display.print("190.168.0.13");
//Wifi Signal
display.setTextSize(1);
display.setCursor(0,40);
display.print("SIGNAL =");
display.display();
delay(2000);
display.clearDisplay();
}
if (modeState == LOW){
buttonState = 1;}
if (buttonState == 1){
//display.display();
delay(750);
display.clearDisplay();}
if (screenState == LOW && buttonState == 1);{
delay(750);
buttonState = 0;
display.display();
}
delay(500);
}