I am trying to build an OS simulator, but I am currently in a trouble

Hi there !

So well, I have been trying to do this one project nowadays - an OS simulator for Arduino Uno and above. I made the header files and made all corrections to the code but it seems not to work as required. The problem I am facing is that when I tried to run a sample app I created for my platform (it was supposed to show up a "Hello!" on my LCD screen), nothing appears on the screen. I thought I'd have to pause the display-on-LCD task (the component task of the app) after it runs, but it was of no use. I have included the code in my new Github repo for the project : MCUOS .

It will be great if anyone could help me resolve this issue. I am sorry that I haven't added sufficient comments in my code, so maybe you'll find it difficult to work out where the error(s) is. If you ever get confused, please to tell me.

See the notes at the top of the forum on how to use the forum and post code - very few people will go off site looking for code - and poor comments also help to reduce the help you might get

Also the search function works - try searching for " I Need a Help Regarding My Project" by definition almost everyone that posts a question in a help forum is looking for help - a good title helps as some that help here only have a few minutes of spare time to help and will skip titles like yours

Thanks, @saildude , I'll change the title...

I have edited the title as per your suggestion; would that attract help ?

About the comments in my code : I had to do everything fast to save up time for corrections, so I missed out to add comments in the hope that whatever I'm gonna try may work and if it does, I can think of adding comments before I post it on Github.

Did you change a multitasking library without using any debug messages and you expect it to work the first time :astonished:

At least show something on the serial monitor:

void setup() 
  Serial.begin( 9600);
  Serial.println( "The sketch has started");

Then add more debug messages.

To debug it, you can put everything in a single file and use Tinkercad (autodesk account required) or use the multiple files as they are with Wokwi.

@Koepel you mean I have to add the indicator of the sketch being in running in the setup() function in AppTest.ino ?

That is up to you, but I think it would be nice if at least something is displayed on the serial monitor, so you know the board is running.

1 Like

The indicator I am looking for is the message that should come on the LCD screen.

I had once tried a task that will show up a message in the serial monitor (without the scheduler and stuff), and it worked.

Thanks for that advice !!

I decided to put a message in the test app to monitor where the process breaks off. It ran the tasks in the first run, but it seems to have broken down afterwards.

have you published your sketch in code tags </> already?
How du you define an OS ?

I am not a CS student, so perhaps, in my way:

An OS is something that acts as an interface between the user and the computer's machinery to perform various tasks.

I am just building a simulation and not a real one.

What do you mean by code tags ? Do you mean my posting the code in this preset?

Now I seem to have caught the problem : the tasks run in the first run or registry.run_tasks(), but since the exit_app variable in the Button_Check task (the btask instance of this, specifically) is set to true by default, the app quits suddenly.

I'll post the current build of the library in Github.

Now the problem is that the button press to stop the app is not being detected. I was able to successfully able to make the app's loop occur, but I find no way in which I can stop the loop :laughing:

More Better - thanks

On comments, I add them when I write the code and use meaningful variable names - it is I think a common misconception that it is quicker to skip comments - the problem comes a few hours or days later when someone (or the original designer) tries to understand the program - a mess - others say "I will add the comments later" - never seems to happen -

I spent a lot of time troubleshooting industrial systems with poor comments while the systems and plant was running - or in some cases the plant was down and poor documentation made my job much harder

Try working with a program where the variables were like I:01/08 or O:05/14

Good luck & thanks for updating the post

Thanks for that advice, I'll get into it shortly.

I was able to resolve the problem of my app quitting suddenly, but I ended up being unable to stop it (:laughing: ). I don't understand if the tasks are running in the background as I expected them to run, but no output is displayed on my LCD device..

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.