X-Git-Url: http://git.piffa.net/web?p=sketchbook_andrea;a=blobdiff_plain;f=multitasking%2FBlinkWithoutDelay_8_struct_pointer%2FBlinkWithoutDelay_8_struct_pointer.ino;h=9e36670b9b65bbe63cd7714500b168b3e6067699;hp=d5cd783706e526241d90a7f03aa4901f8c15db9b;hb=e4de8b95aa9b8019b3fff9416918a4840aae46b5;hpb=98f12e9ba20d5b505b1b6506569e31af9ac3ba89 diff --git a/multitasking/BlinkWithoutDelay_8_struct_pointer/BlinkWithoutDelay_8_struct_pointer.ino b/multitasking/BlinkWithoutDelay_8_struct_pointer/BlinkWithoutDelay_8_struct_pointer.ino index d5cd783..9e36670 100644 --- a/multitasking/BlinkWithoutDelay_8_struct_pointer/BlinkWithoutDelay_8_struct_pointer.ino +++ b/multitasking/BlinkWithoutDelay_8_struct_pointer/BlinkWithoutDelay_8_struct_pointer.ino @@ -40,7 +40,10 @@ void loop() //////////////// // Funzioni -void lightLed(struct blinkLed *temp) { // temp ora e' un pointer e non una struttura autonoma: pass by reference (not by value) +void lightLed(struct blinkLed *temp) { // temp ora e' un pointer e non una copia autonoma: pass by reference (not by value) +// Si noti che la funzione e' ora void dato che non deve tornare a passare nulla al loop: molto +piu' semplice (una sorta di polimorfismo). + // Illumina il ledA secondo un intervallo passato come argomento if(millis() - (*temp).previousMillis >= (*temp).interval) { // l'operatore punto ha priorita' maggiore rispetto al pointer asterisco