Mbed Error - HELP

Hello guys,

I am having some issues with my mini project for college. I’m trying to make a Pong game. I’m getting error “No instance of constructor “mbed::SPI::SPI” matches the argument list in “main.cpp”, Line: 5, Col: 10”. I tried with importing library for tft 1.44 spi lcd which I’m using and the error is still there. Don’t know what to do. I’m still a beginner in coding and I’m still learning. Thanks for help! I’m using Nucleo stm32f446re with tft 1.44 spi display, 2 sliding potentiometers and push button.

[Code]
(Pong_Game_Project - I have some issues and errors with code I'm tryin… | Mbed)

hqdefault


Processing: 20220115_194657.jpg…

Hello,

you have a mistake in the constructor of SPI, it does not have 5 function parameters, it need only for 3-4 and that depends to your requirements about CS control.

// mosi, miso, sclk,  ssel = NC
SPI spi(PA_9,PC_7,PB_6,PA_7,PA_5); //wrong

BR, Jan

  • I do not think it is good practice connect Morpho headers to breadboards.
  • You also wrote about some library, but you do not include any library and also you not have any library in your project.
  • Methods, what you call in the context of SPI do not make sense. SPI does not have such methods. So you probably copied and rewrote the constructor from a Graphic library.
        spi.text_width(1);
        spi.text_height(1);
        //
        spi.filled_circle(bx, by, 2, 0xffffff);
        spi.filled_rectangle(0, P1y1, 3, P1y2, 0xffffff);
        spi.filled_rectangle(124, P2y1, 127, P2y2, 0xffffff);
        spi.filled_rectangle(0, 9, 3, P1y1-1, 0);
        spi.filled_rectangle(0, P1y2+1, 3, 127, 0);
        spi.filled_rectangle(124, 9, 127, P2y1-1, 0);
        spi.filled_rectangle(124, P2y2+1, 127, 127, 0);
        spi.line(5, 8, 122, 8, 0xffffff);
        //
        spi.locate(2,0);
        spi.printf("P1: %d    P2: %d",P1S,P2S);

BR, Jan

Thanks a lot. Yeah I know I have a lot of stupid mistakes, but as I said, I’m a total beginner in this. I need to finish this project by February. You just gave me great advice that will help.

There is nothing wrong with being a beginner, everyone must begin somehow. Important is make an effort, that will teach you.
Do not hesitate and ask for help if you get stuck somewhere.

BR, Jan