Files
NMM-1/firmware/v01/v01.ino

70 lines
1.7 KiB
C++
Executable File

/*********************************************************************
*********************************************************************/
#include <SPI.h>
#include <Wire.h>
#include <SoftwareSerial.h>
#include "Adafruit_GFX.h"
#include "Adafruit_SSD1306.h"
#define OLED_RESET 8
Adafruit_SSD1306 display(OLED_RESET);
// Create SoftwareSerial object and designate pins
SoftwareSerial mySerial(6, 7); // RX, TX
#if (SSD1306_LCDHEIGHT != 32)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif
void setup() {
//Serial.begin(9600);
// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
// by default, we'll generate the high voltage from the 3.3v line internally! (neat!)
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3C (for the 128x32)
// init done
// Show image buffer on the display hardware.
// Since the buffer is intialized with an Adafruit splashscreen
// internally, this will display the splashscreen.
display.display();
delay(2000);
// Clear the buffer.
display.clearDisplay();
// Draw the battery icon
display.drawRect(111, 1, 16, 6, WHITE);
display.drawPixel(110, 3, WHITE);
display.drawPixel(110, 4, WHITE);
display.drawPixel(109, 3, WHITE);
display.drawPixel(109, 4, WHITE);
display.drawPixel(108, 3, WHITE);
display.drawPixel(108, 4, WHITE);
// Show the display buffer on the hardware.
// NOTE: You _must_ call display after making any drawing commands
// to make them visible on the display hardware!
display.display();
delay(2000);
//display.clearDisplay();
}
void loop() {
mySerial.println("TX working, yeaiii :)");
delay(5000);
}