diff options
| author | adiee5 <58359866+adiee5@users.noreply.github.com> | 2026-03-17 00:36:27 +0100 |
|---|---|---|
| committer | adiee5 <58359866+adiee5@users.noreply.github.com> | 2026-03-17 00:36:27 +0100 |
| commit | f9032ca0d68f0b2ba7c007e90444c7e88d32e194 (patch) | |
| tree | 23eea612019ed8c7a263e257f0eb3f1d6be51a58 /src | |
| parent | 71bdb9a31ceaf97c6bb2c4bc0d2834299bea874c (diff) | |
True init
Diffstat (limited to 'src')
| -rw-r--r-- | src/i2ccheck.cpp.q | 51 | ||||
| -rw-r--r-- | src/main.cpp | 62 |
2 files changed, 113 insertions, 0 deletions
diff --git a/src/i2ccheck.cpp.q b/src/i2ccheck.cpp.q new file mode 100644 index 0000000..f849ba1 --- /dev/null +++ b/src/i2ccheck.cpp.q @@ -0,0 +1,51 @@ +#include <Wire.h> +#include <Arduino.h> + +void setup() { + Wire.begin(); + + Serial.begin(9600); + while (!Serial); // Leonardo: wait for serial monitor + Serial.println("\nI2C Scanner"); +} + +void loop() { + byte error, address; + int nDevices; + + Serial.println("Scanning..."); + + nDevices = 0; + for (address = 1; address < 127; address++ ) + { + // The i2c_scanner uses the return value of + // the Write.endTransmisstion to see if + // a device did acknowledge to the address. + Wire.beginTransmission(address); + error = Wire.endTransmission(); + + if (error == 0) + { + Serial.print("I2C device found at address 0x"); + if (address < 16) + Serial.print("0"); + Serial.print(address, HEX); + Serial.println(" !"); + + nDevices++; + } + else if (error == 4) + { + Serial.print("Unknown error at address 0x"); + if (address < 16) + Serial.print("0"); + Serial.println(address, HEX); + } + } + if (nDevices == 0) + Serial.println("No I2C devices found\n"); + else + Serial.println("done\n"); + + delay(5000); // wait 5 seconds for next scan +} diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..ad04a67 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,62 @@ +#include <Arduino.h> +//#include <Wire.h> +#include <Adafruit_SSD1306.h> + +Adafruit_SSD1306 display(128, 64); + +uint8_t zz[]={ + 0b11111111, + 0b11111111, + 0b11111111, + + 0b11011001, + 0b11100010, + 0b01111111, + + 0b10011010, + 0b10111010, + 0b10111111, + + 0b11011101, + 0b11110110, + 0b10111111, + + 0b11011010, + 0b10111010, + 0b10111111, + + 0b10001100, + 0b11100011, + 0b00111111, + + 0b11111111, + 0b11111111, + 0b11111111 +}; + +void setup() { + digitalWrite(2, 0); + delay(500); + if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3c)){ + digitalWrite(2, 1); + while (true); + } + //display.display(); + //delay(2000); + //display.drawLine(10, 10, 20, 20,1); + display.clearDisplay(); + + display.drawBitmap(80, 0, zz, 24,7,1); + //display.setCursor(35,30); + //display.setTextColor(2); + //display.println("Cicho\xa4\xb0\xb1\xb2"); + + display.display(); +} + +void loop() { + //digitalWrite(2, 0); + //delay(1000); + //digitalWrite(2, 1); + //delay(1000); +}
\ No newline at end of file |
