I am new to the ARM world, and just started using a Due today.
Is it possible for two different loops in the scheduler to call upon the same pin?
For example:
loop1(){
digitalWrite(13,HIGH);
delay(100);
digitalWrite(13,LOW);
delay(100);
}
loop2(){
digitalWrite(13,HIGH);
delay(500);
digitalWrite(13,LOW);
delay(500);
}
That's a little bit of an extreme case. But even if I wrote my sketch so that it wouldn't allow a pin to be set high and low at the same time, would the Due handle that?
I don't think the Arduino environment has any multitasking on the Due, beyond
interrupts. Or have I missed something (I'd guess the support is probably there in
libsam anyway).
MarkT:
I don't think the Arduino environment has any multitasking on the Due, beyond
interrupts. Or have I missed something (I'd guess the support is probably there in
libsam anyway).
@MarkT I don't know if it's true multitasking (I wouldn't know how to tell) But the 'Multiple Blinks' example shows that you can have two functions run simultaneously. http://arduino.cc/en/Tutorial/MultipleBlinks
Maybe I am just not understanding it correctly... Please excuse my non-EE background
Yes OK, I was not aware that there is a scheduler library, your terminology is correct.
Anyway my comment still stands, you can write to a pin whenever you want from wherever you want, it's up to you to get it right that's all. In that 'Multiple Blinks' example you could have all three loops write to the same pin/LED, what it would look like is anyone's guess but it would work.
two functions run simultaneously
They don't run "simultaneously", it might appear that way to a human but a CPU can only do one thing at a time.
Do you have a specific application that need two processes to control the same pin?
I didn't have any specific project in mind. I was playing the around with my new Due, and was curious how far I could push it.
Though, if I do try making something like this, I'll post either my success or failure.