Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. #include <U8g2lib.h>
  2. #include <SPI.h>
  3.  
  4. //Pin definitions:
  5.  
  6. const int control_PWM = A3; //PWM output for the delay
  7.  
  8. const int btn_1 = 1; //Button for mode 1
  9. const int btn_2 = 4; //Button for mode 2
  10. const int btn_3 = 5; //Button for mode 3
  11.  
  12. const int r_A = 2; //Rotary encoder A's data
  13. const int r_B = 3; //Rotary encoder A's data
  14. const int r_SW = 0; //Rotary encoder's button data
  15.  
  16. const int oled_CLK = 9; //SPI cloack
  17. const int oled_MOSI = 8; //MOSI pin
  18. const int oled_CS = 7; //Chip Select pin
  19. const int oled_DC = 6; //OLED's D/C pin
  20. U8G2_SH1106_128X64_NONAME_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
  21.  
  22. int mode = 1; //1: RGB, 2: HSL, 3: Distance control
  23. int value_selection = 1; //Actual value selectrion
  24. int value1 = 0; //red in mode 1; tint in mode 2
  25. int value2 = 0; ////green in mode 1; saturation in mode 2
  26. int value3 = 0; //blue in mode 1; luminosity in mode 2
  27.  
  28. volatile unsigned int encoderPos = 0; // rotary encoder's current position
  29. unsigned int lastReportedPos = 1; // rotary encoder's previous position
  30. static boolean rotating=false; // is the encoder activity status
  31.  
  32. // interrupter variables
  33. boolean A_set = false;
  34. boolean B_set = false;
  35. boolean A_change = false;
  36. boolean B_change= false;
  37. void setup() {
  38.  
  39. }
  40.  
  41. void loop() {
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement