Closed GeorgeFlorian closed 5 years ago
I'd have to look at how triangle is supposed to work, I've never used it, but is there a chance your coordinates are wrong? Are you still having the problem if you draw a rectangle instead?
I had a look at
void drawTriangle(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color);
void fillTriangle(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color);
an it seems that your example should work but maybe the coordinates are wrong somehow. For one, remove the filltriangle and use the drawtriangle to check the difference
I had a look at
void drawTriangle(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color); void fillTriangle(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color);
an it seems that your example should work but maybe the coordinates are wrong somehow. For one, remove the filltriangle and use the drawtriangle to check the difference
As I said on SmartMatrix's forum, not the coordinates are the problem, because changing them did nothing.
This is the color defintion:
uint16_t myWHITE = matrix->Color(255,255,255);
uint16_t myRED = matrix->Color(255, 0, 0);
uint16_t myGREEN = matrix->Color(0, 255, 0);
This is the method called in void setup()
to print a number and a triangle:
void go_right(unsigned int space){
matrix->clear();
matrix->setTextWrap(false);
matrix->setRotation(0);
matrix->setTextColor(myGREEN);
matrix->setCursor(5,5); //- cursor for 1 digit number
matrix->setTextSize(2);
if(space == 0) {
matrix->setTextColor(myRED);
} else if(space >9) {
matrix->setCursor(5,5); //- cursor for 2 digits number
}
matrix->print(space);
matrix->drawTriangle(41,5,41,25,58,15,myWHITE);
matrix->fillTriangle(41,5,41,25,58,15,myWHITE);
// backgroundLayer.swapBuffers();
// delay(5000);
}
The problem is that it doesn't print the number either. It's not just about the triangle.
So matrix->print(space);
, where unsigned int space = 10
, does nothing.
The same goes with matrix->drawTriangle(41,5,41,25,58,15,myWHITE);
and matrix->fillTriangle(41,5,41,25,58,15,myWHITE);
Ok, I think I see a problem. adafruit::gfx takes a 16bit 565 color for historical reasons. Give it a color of 0x0300 and see if that works
Then look in the lib for setpassthroughcolor (from memory) to pass a 24 bit color instead
Give it a color of 0x0300 and see if that works
Ok. I've changed the colors:
matrix->setTextColor(0x0300);
matrix->drawTriangle(41,5,41,25,58,15,0x0300);
matrix->fillTriangle(41,5,41,25,58,15,0x0300);
It still doesn't work.
Ok, honestly I can't debug your code remotely. Also, given the turnaround time and the fact that you're asking for my time to help you, you really have to do better than "it doesn't work". Is it blank? Wrong color? other? (see http://www.catb.org/~esr/faqs/smart-questions.html for general tips. Yes, it's long, but it's full of good tips if you ask others for help). More generally you have to do more work on your side to explain why it's a problem on my side or at least in the documentation.
You said my code works, my code does draw rectangles and works for you. Take my code, change it to draw triangles instead. Once that's working, morph my code into what you're trying to do with your code and eventually you'll get there. If something is wrong/broken with my published code, do let me know and I'll try to fix it, but I can't help you write or debug your code, especially remotely and apparently in totally different timezones. I'll close this but if you find something wrong in the lib or the example I provide, or the documentation, feel free to reopen and I'll look at what can be improved. Good luck with your project.
Ok, honestly I can't debug your code remotely. Also, given the turnaround time and the fact that you're asking for my time to help you, you really have to do better than "it doesn't work". Is it blank? Wrong color? other? (see http://www.catb.org/~esr/faqs/smart-questions.html for general tips. Yes, it's long, but it's full of good tips if you ask others for help). More generally you have to do more work on your side to explain why it's a problem on my side or at least in the documentation.
You said my code works, my code does draw rectangles and works for you. Take my code, change it to draw triangles instead. Once that's working, morph my code into what you're trying to do with your code and eventually you'll get there. If something is wrong/broken with my published code, do let me know and I'll try to fix it, but I can't help you write or debug your code, especially remotely and apparently in totally different timezones. I'll close this but if you find something wrong in the lib or the example I provide, or the documentation, feel free to reopen and I'll look at what can be improved. Good luck with your project.
I understand that and I am sorry if I bothered you. We are an estimate of 8 hours apart. I'm beginning to get a little obsessed with this project. I've been trying to finish it for the last month and I have little patience to spare. You are perfectly right and I will try to make it work. Thank you for all your time and help !
As a little after-the-holidays update: we forgot to use matrix->show();
. Adding this to the code made it work.
Hello !
I've tried a simple code:
But it lights up the whole display in white.
I am sorry to bother you but I have no experience using this. I've defined my own scan pattern
kPanelType = SMARTMATRIX_HUB75_32ROW_64COL_MOD8SCAN_L540_2727
and made FastLED_Functions example work.