I have an idea I want to pursue. Is it possible to use a processor, that can store multiple functions? What I mean is this. If I push a button, on a robot or object, can I then expect that button to perform the task that the button was assigned to do every time?
Lets say I have a bank of 10 buttons, that are preprogrammed. One button turns on a clock lets, say. Another button will turn on a Neo light pattern when pressed. This happens all the way down the line using those 10 locking buttons or momentary buttons. Is this even possible with a pico, esp or micro controller?
Topic is for everyone in this unprotected private thread. :)
Lets say I have a bank of 10 buttons, that are preprogrammed. One button turns on a clock lets, say. Another button will turn on a Neo light pattern when pressed. This happens all the way down the line using those 10 locking buttons or momentary buttons. Is this even possible with a pico, esp or micro controller?
Topic is for everyone in this unprotected private thread. :)
It is possible :
- with atmega, but these "tasks" must be programmed accordingly, so for each of them you will have an "init" function that will store the parameters in global variables, and then at regular (but as short as possible) intervals you call an "update" function that will check if the task needs to update something. So it's not extra convenient, you will have to optimize the tasks to take as short time as possible to perform their job, else you will have some timing problems with the other tasks. Running 10 tasks in parallel is going to be very difficult if you have time consuming tasks like neopixels animations.
- with pico and ESP it will be easier, because on one side they have much more processing power, and on the other side they run an RTOS (Real Time OS) so you can run tasks in parallel and the OS will share the available processing time between the different tasks. Pico and ESP32 even have 2 cores so they can really do 2 things at the same time
The only drawback is at the moment it is not possible in Blockly, as there are no blocks to manage tasks. I am planning to work on that, as it will also be useful for the "core" or Otto libraries, but I'm pretty slow in what I am working on at the moment so it will take some time to arrive. When it will arrive on Blockly, it will be only for ESP and Pico if it's on Blockly.