OLED Countdown Timer Using Arduino

https://ogbugbu-technologies.com.ng/

This is a practical OLED Countdown Timer using Arduino

  1. Use a rotary encoder to set the countdown duration
  2. Start the timer by pressing the encoder button
  3. Watch the countdown update in real time on an OLED display
  4. Trigger a Red LED when the countdown reaches zero

Perfect for beginners and makers looking for a practical timer easy to build.

Needed Modules

  1. Arduino UNO or any other Arduino board
  2. Breadboard
  3. OLED Display
  4. 1k ohm resistor
  5. LED
  6. Rotary encoder
  7. Jumper wires

🔌 OLED Display Connections

  1. Connect OLED Display pin [SCL] to Arduino pin [SCL]
  2. Connect OLED Display pin [SDA] to Arduino pin [SDA]
  3. Connect OLED Display pin [VCC] to Arduino pin [5V]
  4. Connect OLED Display pin [GND] to Arduino pin [GND]

🔄 Rotary Encoder Module Connections

  1. Connect Encoder pin [CLK] to Arduino pin [3]
  2. Connect Encoder pin [DT] to Arduino pin [2]
  3. Connect Encoder pin [SW] to Arduino pin [4]
  4. Connect Encoder pin [+ (VCC)] to Arduino pin [5V]
  5. Connect Encoder pin [GND] to Arduino pin [GND]

🔴 LED Output Connection

  1. Connect 220Ω resistor to Arduino pin [5]
  2. Connect anode (long leg) of Red LED to the resistor
  3. Connect cathode (short leg) of LED to Arduino [GND]

Circuit Diagram

Full Setup Wiring

Arduino Code

//----------------------------------------------
//
//         Ogbugbu Technologies
//               https://diy.ogbugbu-technologies.com.ng/
//           
//
//------------------ Source --------------------
//
// OLED-CountDown-Timer
//
//----------------------------------------------

#define __V_REFF_ 5.0f
#define VISUINO_ARDUINO_UNO

#include <OpenWire.h>
#include <Mitov.h>
#include <Wire.h>
#include <Mitov_Basic_I2C.h>
#include <Mitov_I2C.h>
#include <Mitov_ArduinoBasicDigitalInputChannel.h>
#include <Mitov_ArduinoBasicDigitalInputOutputChannel.h>
#include <Mitov_ArduinoBasicDigitalChannel.h>
#include <Mitov_ArduinoBasicDigitalPWMChannel.h>
#include <Mitov_Math.h>
#include <Mitov_Counter.h>
#include <Mitov_BinaryGenerators.h>
#include <Mitov_BasicGenerator.h>
#include <Mitov_FormattedText.h>
#include <Mitov_Display_SSD1306_I2C.h>
#include <Mitov_Graphics.h>
#include <Mitov_Graphics_Monochrome.h>
#include <Fonts\Fixed\GraphicsFont5x7.h>
#include <Mitov_LogicFlipFlops.h>
#include <Mitov_RotaryEncoderSensor.h>
#include <Mitov_MultiMerger.h>
#include <Mitov_Button.h>
#include <Mitov_LogicGates.h>


// Shared Component Member Variables

namespace ComponentVariables
{
class
{
public:
  bool Value1 : 1;
  bool Value3 : 1;
  bool Value4 : 1;
  bool Value5 : 1;
  bool Value6 : 1;
  bool Value7 : 1;
  bool Value8 : 1;
  bool Value9 : 1;
  uint32_t Value2 : 31;
  uint32_t Value11 : 27;
  bool Value10 : 1;
  bool Value12 : 1;
  bool Value13 : 1;
  bool Value14 : 1;
  bool Value15 : 1;
  bool Value16 : 1;

} BitFields;

class Variable1
{
public:
  inline static bool GetValue() { return BitFields.Value1; }
  inline static void SetValue( bool AValue ) { BitFields.Value1 = AValue; }

};

class Variable3
{
public:
  inline static bool GetValue() { return BitFields.Value3; }
  inline static void SetValue( bool AValue ) { BitFields.Value3 = AValue; }

};

class Variable4
{
public:
  inline static bool GetValue() { return BitFields.Value4; }
  inline static void SetValue( bool AValue ) { BitFields.Value4 = AValue; }

};

class Variable5
{
public:
  inline static bool GetValue() { return BitFields.Value5; }
  inline static void SetValue( bool AValue ) { BitFields.Value5 = AValue; }

};

class Variable6
{
public:
  inline static bool GetValue() { return BitFields.Value6; }
  inline static void SetValue( bool AValue ) { BitFields.Value6 = AValue; }

};

class Variable7
{
public:
  inline static bool GetValue() { return BitFields.Value7; }
  inline static void SetValue( bool AValue ) { BitFields.Value7 = AValue; }

};

class Variable8
{
public:
  inline static bool GetValue() { return BitFields.Value8; }
  inline static void SetValue( bool AValue ) { BitFields.Value8 = AValue; }

};

class Variable9
{
public:
  inline static bool GetValue() { return BitFields.Value9; }
  inline static void SetValue( bool AValue ) { BitFields.Value9 = AValue; }

};

class Variable2
{
public:
  inline static uint32_t GetValue() { return BitFields.Value2; }
  inline static void SetValue( uint32_t AValue ) { BitFields.Value2 = AValue; }

};

class Variable11
{
public:
  inline static uint32_t GetValue() { return BitFields.Value11; }
  inline static void SetValue( uint32_t AValue ) { BitFields.Value11 = AValue; }

};

class Variable10
{
public:
  inline static bool GetValue() { return BitFields.Value10; }
  inline static void SetValue( bool AValue ) { BitFields.Value10 = AValue; }

};

class Variable12
{
public:
  inline static bool GetValue() { return BitFields.Value12; }
  inline static void SetValue( bool AValue ) { BitFields.Value12 = AValue; }

};

class Variable13
{
public:
  inline static bool GetValue() { return BitFields.Value13; }
  inline static void SetValue( bool AValue ) { BitFields.Value13 = AValue; }

};

class Variable14
{
public:
  inline static bool GetValue() { return BitFields.Value14; }
  inline static void SetValue( bool AValue ) { BitFields.Value14 = AValue; }

};

class Variable15
{
public:
  inline static bool GetValue() { return BitFields.Value15; }
  inline static void SetValue( bool AValue ) { BitFields.Value15 = AValue; }

};

class Variable16
{
public:
  inline static bool GetValue() { return BitFields.Value16; }
  inline static void SetValue( bool AValue ) { BitFields.Value16 = AValue; }

};

} // ComponentVariables

// Arduino Constant Declarations

namespace VisuinoConstants
{
class FloatValue2
{
public:
    inline static constexpr float GetValue() { return 0.811999976634979; }
};

class FloatValue0
{
public:
    inline static constexpr float GetValue() { return 1; }
};

class FloatValue1
{
public:
    inline static constexpr float GetValue() { return 0; }
};

class TextValue1
{
public:
    inline static constexpr const char *GetValue() { return ":"; }
};

class TextValue0
{
public:
    inline static constexpr const char *GetValue() { return ""; }
};

} // VisuinoConstants

// Pin Call Declarations

namespace PinCalls
{
class PinCallerReceive0
{
public:
  void Notify( void *_Data );

};
class PinCallerReceive1
{
public:
  void Notify( void *_Data );

};
class PinCallerReceive2
{
public:
  void Notify( void *_Data );

};
class PinCallerReceive3
{
public:
  void Notify( void *_Data );

};
class PinCallerReceive4
{
public:
  void Notify( void *_Data );

};
class PinCallerReceive5
{
public:
  void Notify( void *_Data );

};
class PinCallerReceive6
{
public:
  void Notify( void *_Data );

};
class PinCallerReceive7
{
public:
  void Notify( void *_Data );

};
class PinCallerReceive8
{
public:
  void Notify( void *_Data );

};
class PinCallerReceive9
{
public:
  void Notify( void *_Data );

};
class PinCallerReceive10
{
public:
  void Notify( void *_Data );

};
class PinCallerReceive11
{
public:
  void Notify( void *_Data );

};
class PinCallerReceive12
{
public:
  void Notify( void *_Data );

};
} // PinCalls

// Call Chains

namespace CallChains
{
class SendByte1
{
public:
  inline static constexpr uint32_t Count() { return 1; }
  static void Call( uint8_t AValue );

};
class RequestData1
{
public:
  inline static constexpr uint32_t Count() { return 1; }
  static void Call();

};
class Processed1
{
public:
  inline static constexpr uint32_t Count() { return 2; }
  static void Call();

};
class CanProcess1
{
public:
  inline static constexpr uint32_t Count() { return 2; }
  static void Call( bool & AResult );

};
class Process1
{
public:
  inline static constexpr uint32_t Count() { return 2; }
  static void Call( Mitov::String &AText );

};
class Render1
{
public:
  inline static constexpr uint32_t Count() { return 0; }
  inline static void Call() {}

};
class InterruptRaising1
{
public:
  inline static constexpr uint32_t Count() { return 1; }
  static void __ICACHE_RAM_ATTR__ Call();

};
class InterruptFalling1
{
public:
  inline static constexpr uint32_t Count() { return 1; }
  static void __ICACHE_RAM_ATTR__ Call();

};
} // CallChains

// Interrupts

namespace Interrupts
{
void __ICACHE_RAM_ATTR__ Handler0();
} // Interrupts

// Interrupt Objects

namespace Interrupts
{
Mitov::TPinInterruptSource<3, Interrupts::Handler0> PinInterruptSource0;
} // Interrupts

// Arduino Board Declarations

namespace BoardDeclarations
{
namespace Types
{
typedef Mitov::ArduinoBasicDigitalChannel<
  Mitov::ConstantProperty<4, bool, true >, // AutoConfig = True (Default)
  Mitov::ConstantProperty<2, bool, false >, // DigitalInputPin_o_IsConnected = False
  Mitov::ConstantProperty<3, bool, false >, // InitialValue = False (Default)
  Mitov::ConstantProperty<5, bool, false >, // IsOutput = False (Default)
  Mitov::ConstantProperty<6, bool, false >, // IsPullUp = False (Default)
  Mitov::ConstantProperty<123, bool, false >, // IsRawInput = 0
  Mitov::DigitalPin_NoImplementation<7 >, // OutputPin
  true, // OutputPin_Board_Connected_
  2 // PIN_DIGITAL
   > TArduinoAdditionalDigitalInterruptChannel1;
} // Types

namespace Instances
{
Types::TArduinoAdditionalDigitalInterruptChannel1 TArduinoAdditionalDigitalInterruptChannel1;
} // Instances

namespace Types
{
typedef Mitov::ArduinoBasicDigitalPWMChannel<
  Mitov::ConstantProperty<9, bool, false >, // AnalogInputPin_o_IsConnected = False
  Mitov::ConstantProperty<4, bool, true >, // AutoConfig = True (Default)
  Mitov::ConstantProperty<2, bool, false >, // DigitalInputPin_o_IsConnected = False
  Mitov::ConstantProperty<3, bool, false >, // InitialValue = False (Default)
  Mitov::ConstantProperty<10, bool, false >, // IsAnalog = False (Default)
  Mitov::ConstantProperty<5, bool, false >, // IsOutput = False (Default)
  Mitov::ConstantProperty<6, bool, false >, // IsPullUp = False (Default)
  Mitov::ConstantProperty<123, bool, false >, // IsRawInput = 0
  Mitov::DigitalPin_NoImplementation<7 >, // OutputPin
  true, // OutputPin_Board_Connected_
  3 // PIN_DIGITAL
   > TArduinoBasicDigitalPWMInterruptChannel1;
} // Types

namespace Instances
{
Types::TArduinoBasicDigitalPWMInterruptChannel1 TArduinoBasicDigitalPWMInterruptChannel1;
} // Instances

namespace Types
{
typedef Mitov::ArduinoBasicDigitalChannel<
  Mitov::ConstantProperty<4, bool, true >, // AutoConfig = True (Default)
  Mitov::ConstantProperty<2, bool, false >, // DigitalInputPin_o_IsConnected = False
  Mitov::ConstantProperty<3, bool, false >, // InitialValue = False (Default)
  Mitov::ConstantProperty<5, bool, false >, // IsOutput = False (Default)
  Mitov::ConstantProperty<6, bool, false >, // IsPullUp = False (Default)
  Mitov::ConstantProperty<123, bool, false >, // IsRawInput = 0
  Mitov::DigitalPin_EmbeddedPinImplementation<7, ::PinCalls::PinCallerReceive0 >, // OutputPin
  true, // OutputPin_Board_Connected_
  4 // PIN_DIGITAL
   > TArduinoAdditionalDigitalChannel1;
} // Types

namespace Instances
{
Types::TArduinoAdditionalDigitalChannel1 TArduinoAdditionalDigitalChannel1;
} // Instances

namespace Types
{
typedef Mitov::ArduinoBasicDigitalPWMChannel<
  Mitov::ConstantProperty<9, bool, false >, // AnalogInputPin_o_IsConnected = False
  Mitov::ConstantProperty<4, bool, true >, // AutoConfig = True (Default)
  Mitov::ConstantProperty<2, bool, true >, // DigitalInputPin_o_IsConnected = True
  Mitov::ConstantProperty<3, bool, false >, // InitialValue = False (Default)
  Mitov::ConstantProperty<10, bool, false >, // IsAnalog = False (Default)
  Mitov::ConstantProperty<5, bool, false >, // IsOutput = False (Default)
  Mitov::ConstantProperty<6, bool, false >, // IsPullUp = False (Default)
  Mitov::ConstantProperty<123, bool, true >, // IsRawInput = -1
  Mitov::DigitalPin_NoImplementation<7 >, // OutputPin
  false, // OutputPin_Board_Connected_
  5 // PIN_DIGITAL
   > TArduinoBasicDigitalPWMChannel1;
} // Types

namespace Instances
{
Types::TArduinoBasicDigitalPWMChannel1 TArduinoBasicDigitalPWMChannel1;
} // Instances

namespace Types
{
typedef ::Mitov::ArduinoI2C<
  Wire, // 1_INSTANCE
  Mitov::ConstantProperty<6, uint32_t, 0 >, // Address = 0 (Default)
  Mitov::EmbeddedCallChain<CallChains::RequestData1 >, // INSTANCE_RequestData
  Mitov::EmbeddedCallChain<CallChains::SendByte1 >, // INSTANCE_SendByte
  Mitov::ConstantProperty<5, bool, false >, // IsSlave = False (Default)
  Mitov::GenericPin_NoImplementation<2 >, // OutputPin
  Mitov::ClockPin_NoImplementation<4 > // RequestOutputPin
   > TArduinoI2C1;
} // Types

namespace Instances
{
Types::TArduinoI2C1 TArduinoI2C1;
} // Instances

} // BoardDeclarations

// Declarations

namespace Declarations
{
namespace Types
{
typedef Mitov::DivideByValue<
  Mitov::ConstantProperty<4, bool, true >, // Enabled = True (Default)
  Mitov::TypedPin_EmbeddedPinImplementation<3, ::PinCalls::PinCallerReceive1, int32_t >, // OutputPin
  int32_t, // TYPE
  Mitov::ConstantProperty<6, int32_t, 60 > // Value = 60
   > DivideByValue1; // TArduinoIntegerDivideByValue
} // Types

namespace Instances
{
Types::DivideByValue1 DivideByValue1; // TArduinoIntegerDivideByValue
} // Instances

namespace Types
{
typedef Mitov::UnaryOperation_Param1<
  Mitov::MultiplyByValue<int32_t>, // BASE
  Mitov::ConstantProperty<4, bool, true >, // Enabled = True (Default)
  Mitov::TypedPin_EmbeddedPinImplementation<3, ::PinCalls::PinCallerReceive2, int32_t >, // OutputPin
  int32_t, // TYPE
  Mitov::ConstantProperty<6, int32_t, 60 > // Value = 60
   > MultiplyByValue1; // TArduinoIntegerMultiplyByValue
} // Types

namespace Instances
{
Types::MultiplyByValue1 MultiplyByValue1; // TArduinoIntegerMultiplyByValue
} // Instances

namespace Types
{
typedef Mitov::UnaryOperation_Param1<
  Mitov::SubtractValue<int32_t>, // BASE
  Mitov::ConstantProperty<4, bool, true >, // Enabled = True (Default)
  Mitov::TypedPin_EmbeddedPinImplementation<3, ::PinCalls::PinCallerReceive3, int32_t >, // OutputPin
  int32_t, // TYPE
  Mitov::VariableProperty<6, int32_t, 0 > // Value = 0
   > SubtractValue1; // TArduinoIntegerSubtractValue
} // Types

namespace Instances
{
Types::SubtractValue1 SubtractValue1; // TArduinoIntegerSubtractValue
} // Instances

namespace Types
{
typedef Mitov::UpDownCounter<
  Mitov::ConstantProperty<4, bool, true >, // Enabled = True (Default)
  Mitov::TypedVariableValueMinMax<22, int32_t, ::ComponentVariables::Variable2, 0, 0, 2147483647 >, // FCount = 0
  Mitov::VariableProperty<6, int32_t, 10 >, // InitialValue = 10
  Mitov::NestedProperty<11, Mitov::GenericValueLimit<
    Mitov::DigitalPin_NoImplementation<8 >, // ReachedOutputPin
    Mitov::ConstantProperty<9, bool, false >, // RollOver = False
    Mitov::ConstantProperty<10, int32_t, 2147483647 > // Value = 2147483647 (Default)
     > >, // Value_Max
  Mitov::NestedProperty<16, Mitov::GenericValueLimit<
    Mitov::DigitalPin_EmbeddedPinImplementation<13, ::PinCalls::PinCallerReceive5 >, // ReachedOutputPin
    Mitov::ConstantProperty<14, bool, false >, // RollOver = False
    Mitov::ConstantProperty<15, int32_t, 0 > // Value = 0
     > >, // Value_Min
  Mitov::TypedVariable<20, bool, ::ComponentVariables::Variable1 >, // NeedsUpdate
  Mitov::TypedPin_EmbeddedPinImplementation<3, ::PinCalls::PinCallerReceive4, int32_t > // OutputPin
   > UpDownCounter1; // TArduinoUpDownCounter
} // Types

namespace Instances
{
Types::UpDownCounter1 UpDownCounter1; // TArduinoUpDownCounter
} // Instances

namespace Types
{
typedef Mitov::PulseGenerator<
  Mitov::ConstantPropertyFloat<8, float, ::VisuinoConstants::FloatValue1 >, // Asymmetry = 0 (Default)
  Mitov::TypedVariableValue<6, bool, ::ComponentVariables::Variable3, false >, // Enabled = False
  Mitov::ConstantPropertyFloat<17, float, ::VisuinoConstants::FloatValue1>, // FPhase = 0
  Mitov::TypedVariable<15, bool, ::ComponentVariables::Variable4 >, // FValue
  Mitov::ConstantPropertyFloat<7, float, ::VisuinoConstants::FloatValue0 >, // Frequency = 1 (Default)
  Mitov::ConstantProperty<4, bool, false >, // InitialValue = False (Default)
  Mitov::DigitalPin_EmbeddedPinImplementation<3, ::PinCalls::PinCallerReceive6 >, // OutputPin
  Mitov::ConstantPropertyFloat<9, float, ::VisuinoConstants::FloatValue1 >, // Phase = 0 (Default)
  Mitov::NestedProperty<14, Mitov::TArduinoGeneratorWhenDisabled<
    Mitov::ConstantProperty<13, bool, false >, // CompleteCycle = False (Default)
    Mitov::ConstantProperty<12, bool, true >, // FCycleCompleted = True
    Mitov::ConstantProperty<11, bool, false > // Reset = False (Default)
     > > // WhenDisabled
   > PulseGenerator1; // TArduinoPulseGenerator
} // Types

namespace Instances
{
Types::PulseGenerator1 PulseGenerator1; // TArduinoPulseGenerator
} // Instances

namespace Types
{
typedef Mitov::FormattedText_Fixed<
  Mitov::ConstantProperty<6, bool, true >, // ClockInputPin_o_IsConnected = True
  2, // Elements_0_CONST
  Mitov::EmbeddedCallChain<CallChains::CanProcess1 >, // Elements_CanProcess
  ::CallChains::Process1, // Elements_Process = 0
  Mitov::EmbeddedCallChain<CallChains::Processed1 >, // Elements_Processed
  Mitov::ConstantProperty<4, bool, true >, // Enabled = True (Default)
  Mitov::TypedVariable<9, bool, ::ComponentVariables::Variable5 >, // FModified
  Mitov::TextPin_EmbeddedPinImplementation<3, ::PinCalls::PinCallerReceive7 > // OutputPin
   > FormattedText1; // TArduinoFormattedText
} // Types

namespace Instances
{
Types::FormattedText1 FormattedText1; // TArduinoFormattedText
} // Instances

namespace Types
{
typedef Mitov::FormattedTextLengthElementTyped<Mitov::FormattedTextElementText<
  Declarations::Types::FormattedText1, // 0_TYPE_OWNER
  Declarations::Instances::FormattedText1, // 1_NAME_OWNER
  Mitov::ConstantProperty<88, bool, true >, // FModified
  Mitov::ConstantProperty<3, char, '0' >, // FillCharacter = '0'
  Mitov::VariablePropertyString<5, ::VisuinoConstants::TextValue0 >, // InitialValue = "" (Default)
  Mitov::ConstantProperty<2, uint32_t, 2 > // Length = 2
   >> TArduinoFormattedTextElementText1;
} // Types

namespace Instances
{
Types::TArduinoFormattedTextElementText1 TArduinoFormattedTextElementText1;
} // Instances

namespace Types
{
typedef Mitov::TextFormatElementInput<Declarations::Types::TArduinoFormattedTextElementText1, Declarations::Instances::TArduinoFormattedTextElementText1, int32_t> TArduinoFormattedTextElementText1_Input_IOWIntegerStream_1;
} // Types

namespace Instances
{
Types::TArduinoFormattedTextElementText1_Input_IOWIntegerStream_1 TArduinoFormattedTextElementText1_Input_IOWIntegerStream_1;
} // Instances

namespace Types
{
typedef Mitov::FormattedTextLengthElementTyped<Mitov::FormattedTextElementText<
  Declarations::Types::FormattedText1, // 0_TYPE_OWNER
  Declarations::Instances::FormattedText1, // 1_NAME_OWNER
  Mitov::ConstantProperty<88, bool, true >, // FModified
  Mitov::ConstantProperty<3, char, '0' >, // FillCharacter = '0'
  Mitov::VariablePropertyString<5, ::VisuinoConstants::TextValue0 >, // InitialValue = "" (Default)
  Mitov::ConstantProperty<2, uint32_t, 2 > // Length = 2
   >> TArduinoFormattedTextElementText2;
} // Types

namespace Instances
{
Types::TArduinoFormattedTextElementText2 TArduinoFormattedTextElementText2;
} // Instances

namespace Types
{
typedef Mitov::TextFormatElementInput<Declarations::Types::TArduinoFormattedTextElementText2, Declarations::Instances::TArduinoFormattedTextElementText2, int32_t> TArduinoFormattedTextElementText2_Input_IOWIntegerStream_1;
} // Types

namespace Instances
{
Types::TArduinoFormattedTextElementText2_Input_IOWIntegerStream_1 TArduinoFormattedTextElementText2_Input_IOWIntegerStream_1;
} // Instances

Mitov::TFormattedTextStringItemIndexed<
  ::VisuinoConstants::TextValue0,
  Declarations::Types::TArduinoFormattedTextElementText1,
  Declarations::Instances::TArduinoFormattedTextElementText1
> _o_FormattedText1_o_Indexed0;

Mitov::TFormattedTextStringItemIndexed<
  ::VisuinoConstants::TextValue1,
  Declarations::Types::TArduinoFormattedTextElementText2,
  Declarations::Instances::TArduinoFormattedTextElementText2
> _o_FormattedText1_o_Indexed1;

namespace Types
{
typedef Mitov::DisplaySSD1306<
  Mitov::Display_odtSSD_I2C<
      TwoWire, // 0_I2C_TYPE_PIN
      Wire, // 1_I2C_NAME_PIN
      Mitov::ConstantProperty<32, uint8_t, 60 > // Address = 60 (Default)
       >, // 0_IMPLEMENTATION
  Mitov::DisplaySSD1306Buffered<
      64, // Height_0_CONST
      128 // Width_0_CONST
       >, // 0_IMPLEMENTATION_BUFFER
  Mitov::DisplayOrientationUp, // 0_IMPLEMENTATION_ORIENTATION
  Mitov::ConstantProperty<6, Mitov::TArduinoBasicMonochromeColor, Mitov::tmcBlack >, // BackgroundColor = tmcBlack (Default)
  Mitov::ConstantPropertyFloat<17, float, ::VisuinoConstants::FloatValue2 >, // Contrast = 0.811999976634979 (Default)
  Mitov::EmbeddedCallChain<CallChains::Render1 >, // Elements_Render
  Mitov::ConstantProperty<33, uint32_t, 0 >, // FCursorX = 0
  Mitov::ConstantProperty<35, uint32_t, 0 >, // FCursorY = 0
  Mitov::NestedProperty<25, Mitov::TArduinoGraphicsMirror<
    Mitov::ConstantProperty<23, bool, false >, // Horizontal = False (Default)
    Mitov::ConstantProperty<24, bool, false > // Vertical = False (Default)
     > >, // Mirror
  Mitov::ConstantProperty<4, Mitov::TArduinoGraphicsOrientation, Mitov::goUp >, // Orientation = goUp (Default)
  Mitov::ConstantProperty<26, bool, true >, // PowerOn = True (Default)
  Mitov::NestedProperty<21, Mitov::TArduinoDisplaySSD1306PreChargePeriod<
    Mitov::ConstantProperty<19, uint32_t, 1 >, // Phase1 = 1 (Default)
    Mitov::ConstantProperty<20, uint32_t, 15 > // Phase2 = 15 (Default)
     > >, // PreChargePeriod
  Mitov::DisplaySSD1306NoReset<Mitov::DigitalPin_NoImplementation<27 > >, // ResetOutputPin
  Mitov::NestedProperty<14, Mitov::TGraphicsTextSettings<
    Mitov::ConstantProperty<13, Mitov::TArduinoMonochromeColor, Mitov::tmcBlack >, // BackgroundColor = tmcBlack (Default)
    Mitov::ConstantProperty<12, Mitov::TArduinoMonochromeColor, Mitov::tmcWhite >, // Color = tmcWhite (Default)
    Mitov::FixedSizeFont<GraphicsFont5x7, 6, 8>, // Font
    Mitov::ConstantProperty<9, uint32_t, 1 >, // Size = 1 (Default)
    Mitov::ConstantProperty<11, bool, false >, // UseCodePage437Symbols = False (Default)
    Mitov::ConstantProperty<10, bool, true > // Wrap = True (Default)
     > >, // Text
  Mitov::ConstantProperty<31, Mitov::TArduinoDisplayOLEDType, Mitov::odtSSD1306 >, // Type = 0 (Default)
  Mitov::ConstantProperty<16, bool, false > // UseChargePump = False (Default)
   > DisplayOLED1; // TArduinoDisplaySSD1306I2C
} // Types

namespace Instances
{
Types::DisplayOLED1 DisplayOLED1; // TArduinoDisplaySSD1306I2C
} // Instances

namespace Types
{
typedef Mitov::GraphicsElementTextField<
  Declarations::Types::DisplayOLED1, // 0_TYPE_OWNER
  Declarations::Instances::DisplayOLED1, // 1_NAME_OWNER
  Mitov::ConstantProperty<8, bool, true >, // AutoSize = True (Default)
  Mitov::ConstantProperty<4, bool, true >, // ClockInputPin_o_IsConnected = True
  Mitov::ConstantProperty<5, Mitov::TArduinoMonochromeColor, Mitov::tmcWhite >, // Color = tmcWhite (Default)
  Mitov::ConstantProperty<2, bool, true >, // Enabled = True (Default)
  Mitov::ConstantProperty<13, Mitov::TArduinoMonochromeColor, Mitov::tmcBlack >, // FillColor = tmcBlack (Default)
  Mitov::NoFont, // Font
  Mitov::ConstantProperty<12, Mitov::TArduinoTextHorizontalAlign, Mitov::thaLeft >, // HorizontalAlign = thaLeft (Default)
  Mitov::VariablePropertyString<17, ::VisuinoConstants::TextValue0 >, // InitialValue = "" (Default)
  Mitov::MonochromeColorOperations, // OPERATIONS
  Mitov::ConstantProperty<14, uint32_t, 2 >, // Size = 2
  Mitov::ConstantProperty<10, bool, true >, // UseCodePage437Symbols = True
  Mitov::ConstantProperty<11, uint32_t, 0 >, // Width = 0
  Mitov::ConstantProperty<9, bool, false >, // Wrap = False (Default)
  Mitov::ConstantProperty<6, int32_t, 30 >, // X = 30
  Mitov::ConstantProperty<7, int32_t, 20 > // Y = 20
   > TArduinoMonochromeGraphicsElementTextFeld1;
} // Types

namespace Instances
{
Types::TArduinoMonochromeGraphicsElementTextFeld1 TArduinoMonochromeGraphicsElementTextFeld1;
} // Instances

namespace Types
{
typedef Mitov::TFlipFlop<
  Mitov::TypedVariable<10, bool, ::ComponentVariables::Variable9 >, // FToggleValue
  Mitov::TypedVariableValue<5, bool, ::ComponentVariables::Variable8, false >, // InitialValue = False (Default)
  Mitov::DigitalPin_NoImplementation<4 >, // InvertedOutputPin
  Mitov::DigitalPin_EmbeddedPinImplementation<3, ::PinCalls::PinCallerReceive8 > // OutputPin
   > TFlipFlop1; // TArduinoTFlipFlop
} // Types

namespace Instances
{
Types::TFlipFlop1 TFlipFlop1; // TArduinoTFlipFlop
} // Instances

namespace Types
{
typedef Mitov::CompareValue<
  Mitov::CompareType_Implementation_ctEqual, // CompareType = 0 (Default)
  Mitov::ConstantProperty<4, bool, true >, // Enabled = True (Default)
  Mitov::TypedVariable<8, bool, ::ComponentVariables::Variable10 >, // FStarted
  Mitov::DigitalPin_DirectBoardPinImplementation<5 >, // OutputPin
  int32_t, // TYPE
  Mitov::ConstantProperty<7, int32_t, 0 > // Value = 0 (Default)
   > CompareValue1; // TArduinoIntegerCompareValue
} // Types

namespace Instances
{
Types::CompareValue1 CompareValue1 = Types::CompareValue1( 0 ); // TArduinoIntegerCompareValue
} // Instances

namespace Types
{
typedef Mitov::RotaryEncoderSensor_Interrupt<
  BoardDeclarations::Types::TArduinoAdditionalDigitalInterruptChannel1, // 0_B_0_TYPE
  BoardDeclarations::Instances::TArduinoAdditionalDigitalInterruptChannel1, // 0_B_1_NAME
  Mitov::ConstantProperty<20, Mitov::TArduinoClockMode::TArduinoClockMode, Mitov::TArduinoClockMode::Falling >, // ClockMode = 0 (Default)
  Mitov::ConstantProperty<21, uint32_t, 0 >, // DebounceInterval = 0 (Default)
  Mitov::ClockPin_NoImplementation<19 >, // DownOutputPin
  Mitov::ConstantProperty<4, bool, true >, // Enabled = True (Default)
  Mitov::TypedVariableValueMinMax<24, int32_t, ::ComponentVariables::Variable11, 0, 0, 99999999 >, // FCount = 0
  Mitov::ConstantProperty<6, int32_t, 10 >, // InitialValue = 10
  Mitov::NestedProperty<11, Mitov::GenericValueLimit<
    Mitov::DigitalPin_NoImplementation<8 >, // ReachedOutputPin
    Mitov::ConstantProperty<9, bool, false >, // RollOver = False
    Mitov::ConstantProperty<10, int32_t, 99999999 > // Value = 99999999
     > >, // Value_Max
  Mitov::NestedProperty<16, Mitov::GenericValueLimit<
    Mitov::DigitalPin_NoImplementation<13 >, // ReachedOutputPin
    Mitov::ConstantProperty<14, bool, false >, // RollOver = False
    Mitov::ConstantProperty<15, int32_t, 0 > // Value = 0
     > >, // Value_Min
  Mitov::TypedPin_EmbeddedPinImplementation<3, ::PinCalls::PinCallerReceive9, int32_t >, // OutputPin
  Mitov::ClockPin_NoImplementation<18 > // UpOutputPin
   > RotaryEncoderSensor1; // TArduinoRotaryEncoderSensor
} // Types

namespace Instances
{
Types::RotaryEncoderSensor1 RotaryEncoderSensor1; // TArduinoRotaryEncoderSensor
} // Instances

namespace Types
{
typedef Mitov::MultiMerger<
  2, // COUNT_InputPins
  Mitov::TypedPin_EmbeddedPinImplementation<3, ::PinCalls::PinCallerReceive10, int32_t > // OutputPin
   > IntegerMultiMerger1; // TArduinoIntegerMultiMerger
} // Types

namespace Instances
{
Types::IntegerMultiMerger1 IntegerMultiMerger1; // TArduinoIntegerMultiMerger
} // Instances

namespace Types
{
typedef Mitov::Button<
  Mitov::ConstantProperty<5, uint32_t, 50 >, // DebounceInterval = 50 (Default)
  Mitov::TypedVariable<6, bool, ::ComponentVariables::Variable12 >, // FLastValue
  Mitov::TypedVariable<8, bool, ::ComponentVariables::Variable13 >, // FValue
  Mitov::DigitalPin_EmbeddedPinImplementation<3, ::PinCalls::PinCallerReceive11 > // OutputPin
   > Button1; // TArduinoButton
} // Types

namespace Instances
{
Types::Button1 Button1; // TArduinoButton
} // Instances

namespace Types
{
typedef Mitov::BooleanInverter<
  Mitov::ConstantProperty<4, bool, true >, // Enabled = True (Default)
  Mitov::DigitalPin_EmbeddedPinImplementation<3, ::PinCalls::PinCallerReceive12 > // OutputPin
   > Inverter1; // TArduinoBooleanInverter
} // Types

namespace Instances
{
Types::Inverter1 Inverter1; // TArduinoBooleanInverter
} // Instances

} // Declarations

// Interrupts

namespace Interrupts
{
void __ICACHE_RAM_ATTR__ Handler0();

OpenWire::PinChangeInterrupt<Mitov::TPinInterruptSource<3, Interrupts::Handler0>, Interrupts::PinInterruptSource0, ::CallChains::InterruptRaising1, ::CallChains::InterruptFalling1> PinHandler0;

void __ICACHE_RAM_ATTR__ Handler0()
{
    PinHandler0.InterruptHandler();
}

} // Interrupts

// Type Converters

namespace TypeConverters
{
Mitov::Convert_BinaryToClock<Mitov::TypedVariable<0, bool, ::ComponentVariables::Variable14 > > Converter0;
Mitov::Convert_BinaryToClock<Mitov::TypedVariable<0, bool, ::ComponentVariables::Variable15 > > Converter1;
Mitov::Convert_BinaryToClock<Mitov::TypedVariable<0, bool, ::ComponentVariables::Variable16 > > Converter2;
} // TypeConverters

// Bindings

namespace Bindings
{
inline void PulseGenerator1_EnabledInputPin_o_Receive( void * ___PTR___, bool __AOriginalValue__ )
{
  bool ___A_VALUE___ = *(bool *)___PTR___;
  if( __AOriginalValue__ == ___A_VALUE___ )
    return;

  Declarations::Instances::PulseGenerator1.Enabled() = ___A_VALUE___;
  Declarations::Instances::PulseGenerator1.UpdateEnabled();
}

} // Bindings

// Call Chains

namespace CallChains
{
void SendByte1::Call( uint8_t AValue )
{
  BoardDeclarations::Instances::TArduinoI2C1.SendByte( AValue );
}

void RequestData1::Call()
{
  BoardDeclarations::Instances::TArduinoI2C1.RequestData();
}

void Processed1::Call()
{
  Declarations::Instances::TArduinoFormattedTextElementText1.Processed();
  Declarations::Instances::TArduinoFormattedTextElementText2.Processed();
}

void CanProcess1::Call( bool & AResult )
{
  Declarations::Instances::TArduinoFormattedTextElementText1.CanProcess( AResult );
  Declarations::Instances::TArduinoFormattedTextElementText2.CanProcess( AResult );
}

void Process1::Call( Mitov::String &AText )
{
  Declarations::_o_FormattedText1_o_Indexed0.Process( AText );
  Declarations::_o_FormattedText1_o_Indexed1.Process( AText );
}

void __ICACHE_RAM_ATTR__ InterruptRaising1::Call()
{
  Declarations::Instances::RotaryEncoderSensor1.InterruptHandlerA( true );
}

void __ICACHE_RAM_ATTR__ InterruptFalling1::Call()
{
  Declarations::Instances::RotaryEncoderSensor1.InterruptHandlerA( false );
}

} // CallChains

// Pin Call Declarations

namespace PinCalls
{
void PinCallerConverterReceive1( void *_Data );
void PinCallerConverterReceive2( void *_Data );
void PinCallerConverterReceive3( void *_Data );
} // PinCalls

// Pin Call Implementations

namespace PinCalls
{
void PinCallerReceive0::Notify( void *_Data )
{
  Declarations::Instances::Button1.InputPin_o_Receive( _Data );
}

void PinCallerReceive1::Notify( void *_Data )
{
  Declarations::Instances::FormattedText1.ClockInputPin_o_Receive( _Data );
  Declarations::Instances::TArduinoFormattedTextElementText1_Input_IOWIntegerStream_1.InputPin_o_Receive( _Data );
  Declarations::Instances::MultiplyByValue1.InputPin_o_Receive( _Data );
}

void PinCallerReceive2::Notify( void *_Data )
{
  Declarations::Instances::SubtractValue1.Value().InputPin_o_Receive( _Data );
}

void PinCallerReceive3::Notify( void *_Data )
{
  Declarations::Instances::FormattedText1.ClockInputPin_o_Receive( _Data );
  Declarations::Instances::TArduinoFormattedTextElementText2_Input_IOWIntegerStream_1.InputPin_o_Receive( _Data );
}

void PinCallerReceive4::Notify( void *_Data )
{
  Declarations::Instances::IntegerMultiMerger1.InputPins_o_Receive( 0, _Data );
}

void PinCallerReceive5::Notify( void *_Data )
{
  TypeConverters::Converter0.Convert( _Data, PinCallerConverterReceive1 );
}

void PinCallerConverterReceive1( void *_Data )
{
  Declarations::Instances::TFlipFlop1.ResetInputPin_o_Receive( _Data );
}
void PinCallerReceive6::Notify( void *_Data )
{
  TypeConverters::Converter1.Convert( _Data, PinCallerConverterReceive2 );
}

void PinCallerConverterReceive2( void *_Data )
{
  Declarations::Instances::UpDownCounter1.DownInputPin_o_Receive( _Data );
  Declarations::Instances::FormattedText1.ClockInputPin_o_Receive( _Data );
}
void PinCallerReceive7::Notify( void *_Data )
{
  Declarations::Instances::TArduinoMonochromeGraphicsElementTextFeld1.ClockInputPin_o_Receive( _Data );
  Declarations::Instances::TArduinoMonochromeGraphicsElementTextFeld1.InputPin_o_Receive( _Data );
}

void PinCallerReceive8::Notify( void *_Data )
{
  bool __Value_PulseGenerator1_EnabledInputPin__ = Declarations::Instances::PulseGenerator1.Enabled().GetValue();
  ::Bindings::PulseGenerator1_EnabledInputPin_o_Receive( _Data, __Value_PulseGenerator1_EnabledInputPin__ );
}

void PinCallerReceive9::Notify( void *_Data )
{
  Declarations::Instances::IntegerMultiMerger1.InputPins_o_Receive( 1, _Data );
  Declarations::Instances::UpDownCounter1.ResetInputPin_o_Receive( _Data );
  Declarations::Instances::UpDownCounter1.InitialValue().InputPin_o_Receive( _Data );
}

void PinCallerReceive10::Notify( void *_Data )
{
  Declarations::Instances::DivideByValue1.InputPin_o_Receive( _Data );
  Declarations::Instances::SubtractValue1.InputPin_o_Receive( _Data );
  Declarations::Instances::CompareValue1.InputPin_o_Receive( _Data );
  Declarations::Instances::FormattedText1.ClockInputPin_o_Receive( _Data );
}

void PinCallerReceive11::Notify( void *_Data )
{
  Declarations::Instances::Inverter1.InputPin_o_Receive( _Data );
}

void PinCallerReceive12::Notify( void *_Data )
{
  TypeConverters::Converter2.Convert( _Data, PinCallerConverterReceive3 );
}

void PinCallerConverterReceive3( void *_Data )
{
  Declarations::Instances::UpDownCounter1.ResetInputPin_o_Receive( _Data );
  Declarations::Instances::FormattedText1.ClockInputPin_o_Receive( _Data );
  Declarations::Instances::TFlipFlop1.ClockInputPin_o_Receive( _Data );
}
} // PinCalls

namespace ComponentsHardware
{
void SystemUpdateHardware()
{
}
} // ComponentsHardware

//The setup function is called once at startup of the sketch
void setup()
{
  BoardDeclarations::Instances::TArduinoI2C1.SystemInit();
  BoardDeclarations::Instances::TArduinoAdditionalDigitalInterruptChannel1.SystemInit();
  BoardDeclarations::Instances::TArduinoBasicDigitalPWMInterruptChannel1.SystemInit();
  BoardDeclarations::Instances::TArduinoAdditionalDigitalChannel1.SystemInit();
  BoardDeclarations::Instances::TArduinoBasicDigitalPWMChannel1.SystemInit();
  Declarations::Instances::UpDownCounter1.SystemInit();
  Declarations::Instances::DisplayOLED1.SystemInit();
  Declarations::Instances::RotaryEncoderSensor1.SystemInit();

  Interrupts::PinHandler0.InitInterrupt();

  BoardDeclarations::Instances::TArduinoAdditionalDigitalInterruptChannel1.SystemStart();
  BoardDeclarations::Instances::TArduinoBasicDigitalPWMInterruptChannel1.SystemStart();
  BoardDeclarations::Instances::TArduinoAdditionalDigitalChannel1.SystemStart();
  Declarations::Instances::UpDownCounter1.SystemStart();
  Declarations::Instances::PulseGenerator1.SystemStart();
  Declarations::Instances::FormattedText1.SystemStart();
  Declarations::Instances::TArduinoFormattedTextElementText1.SystemStart();
  Declarations::Instances::TArduinoFormattedTextElementText2.SystemStart();
  Declarations::Instances::DisplayOLED1.SystemStart();
  Declarations::Instances::TFlipFlop1.SystemStart();
  Declarations::Instances::CompareValue1.SystemStart();
  Declarations::Instances::RotaryEncoderSensor1.SystemStart();
  Declarations::Instances::Button1.SystemStart();
}

// The loop function is called in an endless loop
void loop()
{
  BoardDeclarations::Instances::TArduinoAdditionalDigitalInterruptChannel1.SystemLoopBegin();
  BoardDeclarations::Instances::TArduinoBasicDigitalPWMInterruptChannel1.SystemLoopBegin();
  BoardDeclarations::Instances::TArduinoAdditionalDigitalChannel1.SystemLoopBegin();
  Declarations::Instances::PulseGenerator1.SystemLoopBegin();
  Declarations::Instances::RotaryEncoderSensor1.SystemLoopBegin();
  Declarations::Instances::Button1.SystemLoopBegin();
  Declarations::Instances::DisplayOLED1.SystemLoopEnd();
}

Author: Ogbugbu Technologies

Leave a Reply

Your email address will not be published. Required fields are marked *