Add Schematics - Formating Code
This commit is contained in:
@@ -12,7 +12,9 @@
|
|||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Version 1.5, 16.12.2020, AK-Homberger
|
// Based on the AK-Homberger work
|
||||||
|
// By Laurent D.
|
||||||
|
// Version 1.0
|
||||||
|
|
||||||
#include <avr/pgmspace.h>
|
#include <avr/pgmspace.h>
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
@@ -22,23 +24,33 @@
|
|||||||
#include <RCSwitch.h> // May impact the display ....
|
#include <RCSwitch.h> // May impact the display ....
|
||||||
#include <SoftwareSerial.h>
|
#include <SoftwareSerial.h>
|
||||||
|
|
||||||
#define PIN_SOFTSERIAL_RX 3
|
/* PINNOUT */
|
||||||
#define PIN_SOFTSERIAL_TX 4
|
|
||||||
#define PIN_RF_433 0 // THIS IS THE INTERUPT. 0 = pin2
|
|
||||||
#define PIN_LED 6
|
|
||||||
#define PIN_BUZZ 7
|
|
||||||
|
|
||||||
#define I2C_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
|
// Definition Value // ATMEGA HW PIN // GPIO // Role
|
||||||
#define SCREEN_WIDTH 128 // OLED display width, in pixels
|
// ================================== // =============== // ==== // =========
|
||||||
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
|
// Hardware SERIAL RX // ATMEGA328 #2 // // SeaTalk
|
||||||
|
// Hardware SERIAL TX // ATMEGA328 #3 // // SeaTalk
|
||||||
|
#define PIN_SOFTSERIAL_RX 3 // ATMEGA328 #5 // 3 // Debug Serial RW
|
||||||
|
#define PIN_SOFTSERIAL_TX 4 // ATMEGA328 #6 // 4 // Debug Serial TX
|
||||||
|
#define PIN_RF_433 0 // ATMEGA328 #4 // 2 // Interrupt 0 , RF433 Input Data
|
||||||
|
#define PIN_LED 6 // ATMEGA328 #12 // 6 // LED PIN
|
||||||
|
#define PIN_BUZZ 7 // ATMEGA328 #13 // 7 // Buzzer PIN
|
||||||
|
// SSD1306 SCL // ATMEGA328 #28 // // oled SSD1306 SCL Pin
|
||||||
|
// SSD1306 SDA // ATMEGA328 #27 // // oled SSD1306 SDA Pin
|
||||||
|
|
||||||
|
/* OTHER CONFIGS */
|
||||||
|
|
||||||
|
#define I2C_ADDRESS 0x3C // Addresses can be 0x3D OR 0x3C depending of manufacturer
|
||||||
|
#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)
|
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
|
||||||
#define RST_PIN -1 // Reset pin # (or -1 if sharing Arduino reset pin)
|
#define SSD1306_RST_PIN -1 // Reset pin # (or -1 if sharing Arduino reset pin)
|
||||||
|
|
||||||
#define Auto_Standby_Support 1 // Set this to 1 to support Standby and Auto for Key 5 and 6
|
#define Auto_Standby_Support 1 // Set this to 1 to support Standby and Auto for Key 5 and 6
|
||||||
|
|
||||||
#define KEY_DELAY 300 // 300 ms break between keys
|
#define KEY_DELAY 300 // 300 ms break between keys
|
||||||
#define BEEP_DURATION 150 // 150 ms beep time
|
#define BEEP_DURATION 150 // 150 ms beep time
|
||||||
|
|
||||||
#define DEBUG
|
#define DEBUG
|
||||||
|
|
||||||
@@ -83,11 +95,10 @@ unsigned long key_time = 0; // time of last key detected
|
|||||||
unsigned long beep_time = 0; // timer for beep duration
|
unsigned long beep_time = 0; // timer for beep duration
|
||||||
bool beep_status = false;
|
bool beep_status = false;
|
||||||
|
|
||||||
uint32_t value_rf = 0;
|
uint32_t value_rf = 0;
|
||||||
char AWS[4];
|
char AWS[4];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
RCSwitch mySwitch = RCSwitch();
|
RCSwitch mySwitch = RCSwitch();
|
||||||
SSD1306AsciiWire oled;
|
SSD1306AsciiWire oled;
|
||||||
SoftwareSerial SerialSoft(PIN_SOFTSERIAL_RX, PIN_SOFTSERIAL_TX); // RX, TX
|
SoftwareSerial SerialSoft(PIN_SOFTSERIAL_RX, PIN_SOFTSERIAL_TX); // RX, TX
|
||||||
@@ -234,11 +245,11 @@ void setup() {
|
|||||||
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
Wire.setClock(400000L);
|
Wire.setClock(400000L);
|
||||||
#if RST_PIN >= 0
|
#if SSD1306_RST_PIN >= 0
|
||||||
oled.begin(&Adafruit128x64, I2C_ADDRESS, RST_PIN);
|
oled.begin(&Adafruit128x64, I2C_ADDRESS, SSD1306_RST_PIN);
|
||||||
#else // RST_PIN >= 0
|
#else // SSD1306_RST_PIN >= 0
|
||||||
oled.begin(&Adafruit128x64, I2C_ADDRESS);
|
oled.begin(&Adafruit128x64, I2C_ADDRESS);
|
||||||
#endif // RST_PIN >= 0
|
#endif // SSD1306_RST_PIN >= 0
|
||||||
oled.setFont(Cooper19);
|
oled.setFont(Cooper19);
|
||||||
oled.clear();
|
oled.clear();
|
||||||
oled.println("Starting");
|
oled.println("Starting");
|
||||||
|
|||||||
Reference in New Issue
Block a user