Unos 0.1.1 - Programs on SD Card Now Supported

Hello,

Attached is the new version of Unos. I have found a way to read a file from an SD card and react to the data accordingly.

NOTE: Create a file called program.txt on an SD card. Otherwise, the Arduino will not recognize the name of the program. You could also change the name program.txt in the library to any other name you like.

Unos_0_1_1.ino (7.82 KB)

OSKIT_0_0_3.h (1.02 KB)

OSKIT_0_0_3.cpp (7.18 KB)

NOTE: Create a file called program.txt on an SD card. Otherwise, the Arduino will not recognize the name of the program.

Please, please, stop.

     else if (PROGRAM_FILE.read() == 'I')
      {
        if (PROGRAM_FILE.read() == 'N')
        {
          if (PROGRAM_FILE.read() == ' ')
          {
            char Ain = PROGRAM_FILE.read();
            pinMode(Ain, INPUT);
            digitalRead(Ain);
          }
        }
      }

What an incredibly pointless thing to do.

    case 12: // rm
      Serial.println(input);
      Serial.println(F("Removing file..."));
      
      SD.remove(input);
      Serial.print(F("root@unos:"));
      break;

If I'm reading your code correctly, at this point, "input" is an empty string.

So basically you're saying that the whole idea is ludicrous.

goodinventor:
So basically you're saying that the whole idea is ludicrous.

No, basically I've been saying that for quite a while. I think that's "present continuous" as opposed to simple "present" tense.

Then how come there are real-time operating systems for the Arduino? How should I be approaching such a system?

Then how come there are real-time operating systems for the Arduino?

Do you know what "non sequitur" means?

"he is not followed"

goodinventor:
How should I be approaching such a system?

You should start at the beginning and learn what an Operating System is.

Spend a few months studying the Linux operating system - all the source code is in the public domain.

If you don't understand the Linux code then spend a few months improving your coding skills until you can understand it.

...R

goodinventor:
"he is not followed"

Close, but no cigar.

Robin2:
You should start at the beginning and learn what an Operating System is.

And then once you do that, think about what resources (memory, bulk disk storage, video, other I/O peripherals, speed, etc.) are available in a typical Linux system, how such a system is typically used, what type of person typically uses it, what facilities an operating system provides for such a system, and why an operating system makes sense for that kind of system.

Then think about the comparatively very limited resources available in an Arduino, what it's typically used for, what type of person typically uses it, and why an operating system does not make sense for that type of system.

Finally, if you still think there is a need for an Arduino OS, think about the combined experience, knowledge, and amount of development time spent by the great number of people who developed an operating system like Linux, and compare that to your own level of experience, knowledge, and available time. What are the odds of you successfully pulling off something like that?

I really hate to be negative and discourage anybody with dreams. But in this case, I think you're better off dropping the grandiose ideas of an Arduino OS, or a Yun LCD touchscreen Linux interface. Instead, come up with some interesting projects that are appropriate for a limited embedded processor like the Arduino, and go and have some FUN with it!

Well, I see that a real-time operating system for scheduling tasks would be really useful for the Arduino. I think I simply need to restructure my approach.

goodinventor:
Well, I see that a real-time operating system for scheduling tasks would be really useful for the Arduino. I think I simply need to restructure my approach.

Yes, pick a single problem and work towards that. Don't try to do everything.

A task scheduler is a good idea, but that's all it is: a task scheduler. Please don't call it a real time operating system, it simply isn't.

Here is an example of an Arduino task scheduler: Metro It provides a mechanism to set up a periodic time base, and you call a function to determine if it's time to perform your function. If it returns true, do your periodic process. A library along those lines is a good fit for an Arduino. The limitation here is that the periodic tasks are small functions that must run to completion before the next task can be considered.

A more advanced library is Scheduler which schedules the running of multiple tasks that can run in parallel: one task doesn't have to complete before the next task has a chance to run. But keep in mind that this library is only for an Arduino Due, which has an ARM processor making it much more capable than an Uno class Arduino. Its processor is closer to the class found in a small Linux computer.

See the trend here? Simple processor, simple functions; more complex processor, more complex functions.

When planning a software project, the first step is to figure out the requirements and what you want to accomplish. Then you can choose a processor that has enough power to do what you want to do. In the latter case (running several tasks in parallel) the Uno class machine simply can't do it because it doesn't have enough RAM to hold a stack for each process, something that is necessary to be able to switch between multiple parallel processes. (Hint: don't try to come up with a scheduling system until you fully understand the basis behind that last statement.)

So for what I was originally intending to do, a Raspberry Pi or Beaglebone is a much better option. I think I'll look into those for a full system, and settle for a task scheduler for the Uno.

goodinventor:
Raspberry Pi or Beaglebone is a much better option
....
and settle for a task scheduler for the Uno.

Yes to RPi and Beaglebone

Personally I would need a lot of convincing that a task scheduler adds value to an Arduino when it is so easy to manage time using millis() - and a great deal more transparent to the programmer when things go wrong. I presume you are familiar with several things at a time.

...R

Somewhat. Having a scheduler, though, would simplify more demanding tasks involving time limits.

goodinventer wrote:

Having a scheduler, though, would simplify more demanding tasks involving time limits.

With the code I have seen thus far in your posts, I'm not sure how it would simplify anything for a programmer needing to have complex or 'demanding' time based event schedules, when, as Robin points out, it is just so easy to use existing functions provided by the compiler such as millis().

I am left wondering after so many suggestions to you that you take some time to learn about a number of concepts, what has your motivation been to continually forge on with what to many of us is seemingly pointless?

I too, would like to suggest to you as ShapeShifter has,

come up with some interesting projects that are appropriate for a limited embedded processor like the Arduino, and go and have some FUN with it!

As your alias might suggest, why not go and invent something good, good for you, where you alone experience enjoyment from learning and tinkering?

Maybe like so many other people, you too can make your Arduino poke, prod, scrunch, regurgitate data from the real world to push, pull, send, store, speak or light to put that child like grin on your face and laugh with delight at your achievement.

Then, we, too can be then happy for you.

I am tiring of this thread, and will now bail out to do more interesting things, I wish you luck.


Paul

goodinventor:
Somewhat. Having a scheduler, though, would simplify more demanding tasks involving time limits.

If the word "somewhat" refers to your familiarity with using millis() for timing then the VERY FIRST THING for your agenda is to become TOTALLY familiar with it before thinking about a scheduler.

I don't agree that a scheduler would benefit "more demanding tasks". All it will do is use more code and more CPU time to do the same job. Like hiring 2 accountants instead of one.

...R

On the contrary, I am completely familiar with using millis() in timing. It is simply the strategy used for schedulers in managing tasks that I do not fully understand.

How do I use my timing function that uses millis() for scheduling?

I am completely familiar with using millis() in timing

How do I use my timing function that uses millis() for scheduling?

Speechless.