Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <U8g2lib.h>
- #include <SPI.h>
- //Pin definitions:
- const int control_PWM = A3; //PWM output for the delay
- const int btn_1 = 1; //Button for mode 1
- const int btn_2 = 4; //Button for mode 2
- const int btn_3 = 5; //Button for mode 3
- const int r_A = 2; //Rotary encoder A's data
- const int r_B = 3; //Rotary encoder A's data
- const int r_SW = 0; //Rotary encoder's button data
- const int oled_CLK = 9; //SPI cloack
- const int oled_MOSI = 8; //MOSI pin
- const int oled_CS = 7; //Chip Select pin
- const int oled_DC = 6; //OLED's D/C pin
- U8G2_SH1106_128X64_NONAME_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
- int mode = 1; //1: RGB, 2: HSL, 3: Distance control
- int value_selection = 1; //Actual value selectrion
- int value1 = 0; //red in mode 1; tint in mode 2
- int value2 = 0; ////green in mode 1; saturation in mode 2
- int value3 = 0; //blue in mode 1; luminosity in mode 2
- volatile unsigned int encoderPos = 0; // rotary encoder's current position
- unsigned int lastReportedPos = 1; // rotary encoder's previous position
- static boolean rotating=false; // is the encoder activity status
- // interrupter variables
- boolean A_set = false;
- boolean B_set = false;
- boolean A_change = false;
- boolean B_change= false;
- void setup() {
- }
- void loop() {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement