first commit
This commit is contained in:
80
src/main.cpp
Normal file
80
src/main.cpp
Normal file
@@ -0,0 +1,80 @@
|
||||
#include <FastLED.h>
|
||||
#include <MyClass.h>
|
||||
#include <BlinkInternLed.h>
|
||||
#include <LedMatrix.h>
|
||||
#include <font_5x7.h>
|
||||
|
||||
LedMatrix matrix;
|
||||
|
||||
void printCharMatrixSimple(char c)
|
||||
{
|
||||
const uint8_t *fontData = getFontChar(c);
|
||||
|
||||
Serial.println();
|
||||
Serial.print("'");
|
||||
Serial.print(c);
|
||||
Serial.println("':");
|
||||
|
||||
String mtrx = "";
|
||||
for (int row = 0; row < 7; row++)
|
||||
{
|
||||
uint8_t line = fontData[row];
|
||||
for (int col = 0; col < 5; col++)
|
||||
{
|
||||
if (line & (1 << (4 - col)))
|
||||
{
|
||||
mtrx += "•";
|
||||
Serial.print("#"); // Einfaches # für Pixel
|
||||
}
|
||||
else
|
||||
{
|
||||
mtrx += ".";
|
||||
Serial.print("."); // Punkt für leere Pixel
|
||||
}
|
||||
}
|
||||
mtrx += "\n\r";
|
||||
Serial.println();
|
||||
}
|
||||
Serial.println(mtrx);
|
||||
}
|
||||
|
||||
void playWithBlinkLed()
|
||||
{
|
||||
BlinkInternLed internLed = BlinkInternLed();
|
||||
String led_status = internLed.ledStatus();
|
||||
Serial.println("PinStatus: " + led_status);
|
||||
|
||||
internLed.on();
|
||||
delay(200);
|
||||
led_status = internLed.ledStatus();
|
||||
Serial.println("PinStatus: " + led_status);
|
||||
|
||||
internLed.off();
|
||||
delay(200);
|
||||
led_status = internLed.ledStatus();
|
||||
Serial.println("PinStatus: " + led_status);
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
matrix.setBrightness(255);
|
||||
|
||||
matrix.clear();
|
||||
matrix.show();
|
||||
|
||||
// Draw static "HELLO WORLD"
|
||||
matrix.drawText(1, 1, "Hello", CRGB::Red);
|
||||
matrix.drawText(35, 1, "World", CRGB::Blue);
|
||||
matrix.drawText(1, 20, "<°|`¶>", CRGB::Yellow);
|
||||
matrix.drawText(1, 30, "Bottom", CRGB::Yellow);
|
||||
matrix.show();
|
||||
|
||||
// printCharMatrixSimple('S');
|
||||
|
||||
// playWithBlinkLed();
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
delay(1000);
|
||||
}
|
||||
94
src/main___.cpp
Normal file
94
src/main___.cpp
Normal file
@@ -0,0 +1,94 @@
|
||||
#ifdef DO_NOT_USE_MAIN___
|
||||
#include <Arduino.h>
|
||||
#include <pico/cyw43_arch.h>
|
||||
#include <WiFi.h>
|
||||
|
||||
#include <Adafruit_NeoMatrix.h>
|
||||
#include <Adafruit_GFX.h>
|
||||
// #include <Fonts/TomThumb.h>
|
||||
|
||||
#include "MyClass.h"
|
||||
|
||||
// LED pin definitions
|
||||
#define LED_ONBOARD LED_BUILTIN
|
||||
|
||||
// Matrix setup
|
||||
#define MATRIX_PIN 28
|
||||
#define MATRIX_WIDTH 64
|
||||
#define MATRIX_HEIGHT 64
|
||||
|
||||
// Adafruit NeoMatrix initialisieren
|
||||
Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(
|
||||
MATRIX_WIDTH, MATRIX_HEIGHT, MATRIX_PIN,
|
||||
NEO_MATRIX_TOP + NEO_MATRIX_LEFT +
|
||||
NEO_MATRIX_ROWS + NEO_MATRIX_ZIGZAG,
|
||||
NEO_GRB + NEO_KHZ800);
|
||||
|
||||
int textX = matrix.width();
|
||||
int textMin = 0;
|
||||
|
||||
void connect_wifi()
|
||||
{
|
||||
// For Wokwi simulation - use simulated WiFi
|
||||
Serial.println("Connecting to WiFi...");
|
||||
|
||||
// In Wokwi, WiFi connects automatically in simulation
|
||||
WiFi.begin("Wokwi-GUEST", ""); // Wokwi's simulated WiFi
|
||||
while (WiFi.status() != WL_CONNECTED)
|
||||
{
|
||||
delay(250);
|
||||
Serial.print(".");
|
||||
}
|
||||
Serial.println("\nConnected to WiFi!");
|
||||
Serial.print("IP address: ");
|
||||
Serial.println(WiFi.localIP());
|
||||
}
|
||||
|
||||
void setupLEDMatrix()
|
||||
{
|
||||
// Matrix initialisieren
|
||||
matrix.begin();
|
||||
|
||||
matrix.setBrightness(200);
|
||||
matrix.fillScreen(0);
|
||||
matrix.setCursor(18, 12);
|
||||
matrix.setTextColor(matrix.Color(0, 255, 0));
|
||||
matrix.print("HELLO");
|
||||
matrix.show();
|
||||
Serial.println("Adafruit NeoMatrix ready - Showing 'Hello World'");
|
||||
}
|
||||
|
||||
void setup___()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
delay(100);
|
||||
|
||||
connect_wifi();
|
||||
|
||||
MyClass myClassObj; // Create an object of MyClass
|
||||
|
||||
// Access attributes and set values
|
||||
myClassObj.myNum = 15;
|
||||
myClassObj.myString = "Some text";
|
||||
|
||||
pinMode(LED_ONBOARD, OUTPUT);
|
||||
Serial.println("Blink example started!");
|
||||
myClassObj.display();
|
||||
|
||||
setupLEDMatrix();
|
||||
}
|
||||
|
||||
void loop___()
|
||||
{
|
||||
|
||||
// Turn LED on
|
||||
digitalWrite(LED_ONBOARD, HIGH);
|
||||
Serial.println("LED ON");
|
||||
delay(1000);
|
||||
|
||||
// Turn LED off
|
||||
digitalWrite(LED_ONBOARD, LOW);
|
||||
Serial.println("LED OFF");
|
||||
delay(1000);
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user