Hassan,
Re. your request to Andy about the push buttons 'toggeling' the blinking LED's enable/disable.
I will start by address your original request for some insight on how to program for parallel actions -
The first trick is to change your focus from the on-going results you desire to the transitions between the on-going results. That is, pressing a button causes an input signal to change from high-to-low (or low-to-high). Releasing the button causes the opposite change. Andy's Ticker object signals each time the allowed LED outputs can change from on-to-off, or off-to-on.
Each of these changes can cause an interrupt, which in turn can have a small subroutine 'attached' to the interrupt. Each such subroutine will then run when the corresponding change occurs.
One subtle trap is that mechanical switches actually produce several short pulses before setteling into the new 'pushed' or 'released' state. So, you want to use the library routines for 'de-bounced' signals on the push-button inputs.
The second trick is to have the subroutines pass the changes on to 'global' variables. That way, the results from all changes are available to any of the subroutines whenever they run.
So, you can modify Andy's code to have the 2 push-button routines each toggle a different global variable (say, 'int LED0_enable, LED1_enable;') in response to a rising (or falling) de-bounced signal. You only need one Ticker if you want both LEDs to march in-step to another toggled variable (say, 'int Pulse_phase;'). Finally, in all 3 subroutines (after they have up-dated the one global variable they are responsible for), calculate and set the desired values for both LED's based on the global variables..
e.g. 'LED0 = LED0_enabled & Pulse_phase; LED1 = LED1_enabled & Pulse_phase;'
Having taken care of all possible transitions, you will then find that the on-going parallel blinking of both LEDs vs the button-pushes has also been taken care of.
Now, re. Ceri's 'BIT BASH'. 'BIT' is a designation for each of the digital input and output signals. 'BASH' is a term that refers to forming things in a crude or unsophisticated manner, as if by hammer blows. So, 'BIT BASH' means that to run the SPI's in parallel, you have to give up using the 'sophisticated' SPI channel in the 1788, and instead write all the code yourself which will set the pins you choose to in, out, or open-collector mode; set each of the clock, chip enable, and data bits (pins) to their needed states; wait for the needed minimum delays on each set of bits sent or received; monitor any open-collector timing extensions from the slaves; etc.
i have a situation where i take readings from a certain sensor connected to the mbed and i if a reading fullfils certain conditions, i want the mbed to execute a certain action at the same time the mbed recieves and records the data comming from the sensor ... do anyone have any idea how to make this happen???
thank you in advance.