July 14, 2016
Have found the level of documentation very good so far but is there any additional documentation with worked examples on the use of the “Start Event” section of the graphical programming work area Also is there additional explanations of the use of the such icons as ‘timer count down’ and its relationship to ‘start event’ if any?
August 24, 2015
Thanks for your comments on our documentation!
The “Start Event” acts as an interrupt to the main program. This means that when the conditions you set in the “Start Event” block are met, Edison pauses the main program and jumps down to the “Start Event” block executing all of the blocks connected to it. When Edison gets to the “End Event” block it jumps back up to the main program and resumes executing from the place it left off.
As an example here is a basic “Bounce in borders” program using the “Start Event” block:
The main program is a simple loop that turns the motors on, waits 0.2 seconds and then returns to the start of the loop. It’s important that the dual drive icon is in the main loop so that Edison starts driving again after the “Start Event”
The “start event” is set to trigger when Edison sees a non-reflective surface. The blocks after the ‘start event” simply turn Edison around.
When this program is run, Edison starts on a reflective surface and sits in the main program driving forwards continuously. While in the main program Edison spends most of his time in the “Wait Event” block, because all red blocks are simply switches and Edison only spends a tiny fraction of a second on them, whereas the “Wait Event” forces Edison to stay on that block for 0.2 seconds (because that is the time I have input). Eventually, Edison will encounter a non-reflective surface, because of the above we can assume Edison is in the “Wait Event” when the non-reflective surface is encountered and let’s say that Edison has been in that block for 0.1 seconds. The non-reflective surface triggers the “Start Event” so Edison turns around and stops, once he has finished turning Edison jumps back to the main program. In the main program, he resumes the “Wait Event” and waits for 0.1 seconds before looping back around and starting to drive forwards again.
The “timer countdown” is a timer that runs in the background and can be used to trigger events, it is very useful if you want an action or a few actions to repeat continuously while your program is running. Here is an example that will rapidly flash the LED regardless of what is happening in the main program:
I have simply put an empty loop as the main program so it continues forever but you could put your own program after the “Countdown timer” block and the rest of the code would keep the left LED rapidly flashing while your code is executing.
This is an example of a “Start Event” that once triggered, triggers itself by resetting the countdown timer.
The time between flashes can be changed by changing the “Countdown timer” block at the end of the new event line
I hope this helps, please let me know if you have any questions.
July 14, 2016
the explanation is clear and therefor I think of the start event as potentially one of many sub routines that could be called as different events occur, So for example the main program could just drive Edison forward with detect obstacle turned on and 2 start events, one to detect objects to the left and hence turn right and the other to detect objects to the right and hence turn left.
thanks also for the explanation of the countdown timer, will give it a try when I get a chance.