diff --git a/LED-Board.ino b/LED-Board.ino index 5769b2d..1640752 100644 --- a/LED-Board.ino +++ b/LED-Board.ino @@ -16,7 +16,8 @@ IPAddress subnet(255, 255, 254, 0); WebSocketsServer webSocket = WebSocketsServer(81); Image image; -Panel panel; +Panel panel1(22, 24, 23); //data, clock, load +Panel panel2(28, 29, 31); ProtocolDL protocol = ProtocolDL(image); unsigned long last_activity = 0; @@ -73,7 +74,8 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t * payload, size_t length if(protocol.isComplete()) { Serial.println("complete"); - panel.send_image(&image); + panel1.send_image(&image); + panel2.send_image(&image); } break; @@ -106,7 +108,8 @@ void setup() { webSocket.begin(); webSocket.onEvent(webSocketEvent); - panel.init(); + panel1.init(); + panel2.init(); Serial.println("setup done"); } @@ -139,6 +142,7 @@ void loop() { if (someOneIsConnected == false) { default_image(&image); - panel.send_image(&image); + panel1.send_image(&image); + panel2.send_image(&image); } } diff --git a/gedoens-excel.xlsx b/gedoens-excel.xlsx index 8300692..e9bb1f3 100644 Binary files a/gedoens-excel.xlsx and b/gedoens-excel.xlsx differ diff --git a/src/panel.cpp b/src/panel.cpp index c19a58d..91f7ac5 100644 --- a/src/panel.cpp +++ b/src/panel.cpp @@ -1,14 +1,17 @@ #include "panel.hpp" -#define LOAD 7 -#define DATA 8 -#define CLOCK 9 +Panel::Panel(uint8_t pData, uint8_t pClock, uint8_t pLoad) +{ + pinData = pData; + pinLoad = pLoad; + pinClock = pClock; +} void Panel::init() { - pinMode(DATA, OUTPUT); - pinMode(CLOCK, OUTPUT); - pinMode(LOAD, OUTPUT); + pinMode(pinData, OUTPUT); + pinMode(pinClock, OUTPUT); + pinMode(pinLoad, OUTPUT); } void Panel::send_image(Image* img) { @@ -23,17 +26,17 @@ void Panel::send_image(Image* img) { void Panel::clock() { - PORTH |= (1 << PH6); - PORTH &= ~(1 << PH6); - //digitalWrite(CLOCK, HIGH); - //digitalWrite(CLOCK, LOW); + //PORTA |= (1 << PA2); + //PORTA &= ~(1 << PA2); + digitalWrite(pinClock, HIGH); + digitalWrite(pinClock, LOW); } void Panel::load() { - PORTH |= (1 << PH4); - PORTH &= ~(1 << PH4); - //digitalWrite(LOAD, HIGH); - //digitalWrite(LOAD, LOW); + //PORTB |= (1 << PB0); + //PORTB &= ~(1 << PB0); + digitalWrite(pinLoad, HIGH); + digitalWrite(pinLoad, LOW); } @@ -79,16 +82,16 @@ void Panel::send_block(Image* p, int x, int y) { byte pixel = p->get_pixel(x + x_offset, y + y_offset); - if(pixel) + /*if(pixel) { - PORTH |= (1 << PH5); + PORTB |= (1 << PB2); } else { - PORTH &= ~(1 << PH5); - } + PORTB &= ~(1 << PB2); + }*/ - //digitalWrite(DATA, pixel); + digitalWrite(pinData, pixel); clock(); } diff --git a/src/panel.hpp b/src/panel.hpp index be854d3..b02198a 100644 --- a/src/panel.hpp +++ b/src/panel.hpp @@ -6,6 +6,7 @@ class Panel { public: + Panel(uint8_t pData, uint8_t pClock, uint8_t pLoad); void init(); void send_image(Image* img); @@ -13,6 +14,9 @@ class Panel void clock(); void load(); void send_block(Image* p, int x, int y); + uint8_t pinData; + uint8_t pinClock; + uint8_t pinLoad; }; #endif \ No newline at end of file