You are reading a single comment by @allObjects and its replies. Click here to read the full conversation.
  • I cannot see anything wrong in the logic of your code. From what I get is that you fill an array with functions that do different lights. Such a light pattern function is then called every 50ms and you start with pattern with index 0. When you press the button, you increment the index (with modulo, currently commented) and run the new pattern - which you get by invoking next pattern.

    ...never mind next paragraph (came across your other conversation about A HY Mini-STM32 VCT6 3.2" board... and there LCD is probably defined... the LCD that is part of the board... but you errors with it and that could be the reason all is failing...)...

    What is not clear to me is the LCD... I don't see any initialization or so... and do not understand what you want to achieve with it... (btw, you set the color first, before you draw,... drawing the rectangle border first, and then draw a filled rectangle, is that what you want?)

    (And btw, cycle is an undeclared global).

    To get to the bottom of the story, check each of your pattern function at once...

    It is a good practice to put your initiating / starting code into onInit() function, so you can make sure that the upload just sets the stuff up (in your case actually fills up the array), but does not right away start to operate on the data/functions.

    After upload, you then enter in the console onInit() and then it begins to run... (if onInit() is too long to type, create a r() - run - function that calls onInit()). You can then also create a s() - stop - function that clears the interval with clearInterval(cycle); to stop the cycling.

About

Avatar for allObjects @allObjects started