| @@ -28,6 +28,9 @@ | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/EchoLot/libraries/LCDWIKI_SPI}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/EchoLot/libraries/ezButton/src}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/EchoLot/libraries/RotaryEncoder/src}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/EchoLot/libraries/Adafruit_GFX_Library}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/EchoLot/libraries/U8g2_for_Adafruit_GFX/src}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/EchoLot/libraries/SSD1283A/src}""/> | |||
| </option> | |||
| <inputType id="io.sloeber.compiler.cpp.sketch.input.543353444" name="CPP source files" superClass="io.sloeber.compiler.cpp.sketch.input"/> | |||
| </tool> | |||
| @@ -42,6 +45,9 @@ | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/EchoLot/libraries/LCDWIKI_SPI}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/EchoLot/libraries/ezButton/src}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/EchoLot/libraries/RotaryEncoder/src}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/EchoLot/libraries/Adafruit_GFX_Library}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/EchoLot/libraries/U8g2_for_Adafruit_GFX/src}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/EchoLot/libraries/SSD1283A/src}""/> | |||
| </option> | |||
| <inputType id="io.sloeber.compiler.c.sketch.input.1984508786" name="C Source Files" superClass="io.sloeber.compiler.c.sketch.input"/> | |||
| </tool> | |||
| @@ -56,6 +62,9 @@ | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/EchoLot/libraries/LCDWIKI_SPI}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/EchoLot/libraries/ezButton/src}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/EchoLot/libraries/RotaryEncoder/src}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/EchoLot/libraries/Adafruit_GFX_Library}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/EchoLot/libraries/U8g2_for_Adafruit_GFX/src}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/EchoLot/libraries/SSD1283A/src}""/> | |||
| </option> | |||
| <inputType id="io.sloeber.compiler.S.sketch.input.2093386672" name="Assembly source files" superClass="io.sloeber.compiler.S.sketch.input"/> | |||
| </tool> | |||
| @@ -46,6 +46,11 @@ | |||
| <type>2</type> | |||
| <location>C:/Users/FSmilari/Documents/Arduino/libraries/Adafruit_BusIO</location> | |||
| </link> | |||
| <link> | |||
| <name>libraries/Adafruit_GFX_Library</name> | |||
| <type>2</type> | |||
| <location>C:/Users/FSmilari/Documents/Arduino/libraries/Adafruit_GFX_Library</location> | |||
| </link> | |||
| <link> | |||
| <name>libraries/LCDWIKI_GUI</name> | |||
| <type>2</type> | |||
| @@ -66,6 +71,16 @@ | |||
| <type>2</type> | |||
| <locationURI>ECLIPSE_HOME/arduinoPlugin/packages/arduino/hardware/avr/1.8.4/libraries/SPI</locationURI> | |||
| </link> | |||
| <link> | |||
| <name>libraries/SSD1283A</name> | |||
| <type>2</type> | |||
| <location>C:/Users/FSmilari/Documents/Arduino/libraries/SSD1283A</location> | |||
| </link> | |||
| <link> | |||
| <name>libraries/U8g2_for_Adafruit_GFX</name> | |||
| <type>2</type> | |||
| <locationURI>ECLIPSE_HOME/arduinoPlugin/libraries/U8g2_for_Adafruit_GFX/1.8.0</locationURI> | |||
| </link> | |||
| <link> | |||
| <name>libraries/Wire</name> | |||
| <type>2</type> | |||
| @@ -1,7 +1,10 @@ | |||
| #include "Arduino.h" | |||
| #include <LCDWIKI_GUI.h> // core graphics library | |||
| #include <LCDWIKI_SPI.h> // hardware-specific library | |||
| //#include <LCDWIKI_SPI.h> // hardware-specific library | |||
| #include <SSD1283A.h> | |||
| #include "RotaryControler.h" | |||
| //#include <U8g2_for_Adafruit_GFX.h> | |||
| #include <Fonts/FreeMonoOblique9pt7b.h> | |||
| const int trigPin = 12; | |||
| const int echoPin = 10; | |||
| @@ -12,7 +15,7 @@ const int echoPin = 10; | |||
| #define GREEN 0x07E0 | |||
| #define WHITE 0xFFFF | |||
| #define MODEL SSD1283A | |||
| //#define MODEL SSD1283A | |||
| #define LED -1 // to +5v | |||
| #define SCK 13//A1 with SCK on 13 and SDA on 11 it is 10x faster!!! | |||
| #define SDA 11//A2 | |||
| @@ -30,7 +33,8 @@ static const int Measure_Pin = 8; | |||
| String lastDistance = ""; | |||
| LCDWIKI_SPI mylcd(MODEL, CS, CD, MISO, MOSI, RST, SCK, LED); //software spi,model,cs,cd,miso,mosi,reset,clk,led | |||
| SSD1283A mylcd( CS, CD, RST, LED); //software spi,model,cs,cd,miso,mosi,reset,clk,led | |||
| //U8G2_FOR_ADAFRUIT_GFX u8g2_gfx; | |||
| RotaryControler RotaryControler(RotEnc_Dta_Pin, RotEnc_Clk_Pin, RotEnc_Switch_Pin); | |||
| ExEzButton MeasureBtn(Measure_Pin, false, 2000); | |||
| @@ -40,8 +44,10 @@ void setup() | |||
| pinMode(trigPin, OUTPUT); | |||
| pinMode(echoPin, INPUT); | |||
| mylcd.Init_LCD(); | |||
| mylcd.Fill_Screen(BLACK); | |||
| // u8g2_gfx.begin(mylcd); | |||
| mylcd.init(); | |||
| mylcd.fillScreen(BLACK); | |||
| mylcd.setFont(&FreeMonoOblique9pt7b); | |||
| pinMode(Measure_Pin, INPUT); | |||
| pinMode(RotEnc_Switch_Pin, INPUT); | |||
| @@ -72,10 +78,10 @@ void loop() | |||
| MeasureBtn.loop(); | |||
| RotaryControler.loop(); | |||
| mylcd.Set_Text_Mode(1); | |||
| mylcd.Set_Text_colour(WHITE); | |||
| mylcd.Set_Text_Back_colour(RED); | |||
| mylcd.Set_Text_Size(2); | |||
| // mylcd.Set_Text_Mode(1); | |||
| mylcd.setTextColor(WHITE); | |||
| // mylcd.Set_Text_Back_colour(RED); | |||
| mylcd.setTextSize(1); | |||
| if (RotaryControler.isSwitchPressed()) { | |||
| Serial.println("RotaryEnc SwitchPressed"); | |||
| @@ -96,21 +102,33 @@ void loop() | |||
| // Serial.println(duration); | |||
| // Serial.print("Distance:"); | |||
| // Serial.println(distance); | |||
| Serial.println(distance); | |||
| char buf[50]; | |||
| sprintf(buf, "%lu cm", distance); | |||
| if (!lastDistance.equals(buf)) { | |||
| mylcd.Fill_Rect(0, 48, 130, 20, RED); | |||
| mylcd.Print_String(buf, 30, 50); | |||
| delay(100); | |||
| lastDistance = buf; | |||
| } | |||
| // if (!lastDistance.equals(buf)) { | |||
| mylcd.fillRect(0, 48, 130, 20, RED); | |||
| // char *s = &String(buf)[0]; | |||
| // int16_t w = 0, h = 0; | |||
| // u8g2_gfx.setFont(u8g2_font_helvB12_tf); | |||
| // w = u8g2_gfx.getUTF8Width(s); | |||
| // h = u8g2_gfx.getFontAscent() - u8g2_gfx.getFontDescent(); | |||
| // u8g2_gfx.setForegroundColor(WHITE); | |||
| // u8g2_gfx.setCursor(30, 50); | |||
| // mylcd.println(s); | |||
| mylcd.setTextColor(WHITE); | |||
| mylcd.setCursor(30, 50); | |||
| mylcd.println(buf); | |||
| delay(100); | |||
| // lastDistance = buf; | |||
| // } | |||
| delay(200); | |||
| } else { | |||
| mylcd.Fill_Screen(BLACK); | |||
| mylcd.fillScreen(BLACK); | |||
| } | |||
| } | |||
| @@ -2,13 +2,14 @@ | |||
| //This is a automatic generated file | |||
| //Please do not modify this file | |||
| //If you touch this file your change will be overwritten during the next build | |||
| //This file has been generated on 2025-12-21 14:22:01 | |||
| //This file has been generated on 2025-12-21 21:41:05 | |||
| #include "Arduino.h" | |||
| #include "Arduino.h" | |||
| #include <LCDWIKI_GUI.h> | |||
| #include <LCDWIKI_SPI.h> | |||
| #include <SSD1283A.h> | |||
| #include "RotaryControler.h" | |||
| #include <Fonts/FreeMonoOblique9pt7b.h> | |||
| void setup() ; | |||
| void loop() ; | |||