Go Down

Topic: Unos 0.1.1 - Programs on SD Card Now Supported (Read 17808 times) previous topic - next topic

goodinventor

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.

AWOL

#1
Jan 24, 2015, 01:18 am Last Edit: Jan 24, 2015, 03:10 pm by AWOL
Quote
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.

Code: [Select]
     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.


Code: [Select]
    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.

goodinventor

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

AWOL

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.

goodinventor

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

AWOL

Quote
Then how come there are real-time operating systems for the Arduino?
Do you know what "non sequitur" means?

goodinventor


Robin2

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
Two or three hours spent thinking and reading documentation solves most programming problems.


ShapeShifter

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!

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.

ShapeShifter

#11
Jan 25, 2015, 01:57 pm Last Edit: Jan 25, 2015, 01:57 pm by ShapeShifter
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.)


goodinventor

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.

Robin2

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
Two or three hours spent thinking and reading documentation solves most programming problems.

goodinventor

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

Go Up