Wednesday, June 30, 2010

June 28 Blink All + Chase

The following application should use the touch sensor to switch between: 
  • blinking 3 leds and 
  • chase of 3 leds.
The touch sensor is used to alternate between blinking all leds and chase = turning an LED on then off and next LED on and soforth.
Blinking 3 LEDs is just "blinky" application using a flip-flop to alternate between on and off.

Unit testing: when button (touch sensor) is
  • not pressed = blink 3 LEDs when button (touch sensor) is not pressed
  • pressed       =  longer delay

Unit testing:  when button (touch sensor) is
  • not pressed = longer delay
  • pressed       = chase 3 LEDs
Chase uses 3 delays of 1500, 1000, and 500 and 3 E_RSs which send 100, 010, 001 (1=on) respectively.









But combining the two has problem because
  • only 1 boolean input is allowed
  • using E_RS only sends it EO output event if there is a state change between R and S. (So can not send cascade E_RS events to change how the events are changed=
In a sequential implementation a LED would be repeated, but would not map 1-to-1 to the HW.

Solution is to create a FB type which has same number of  boolean input/outputs the same as presented in FBDK tutorial in Vyatkin's book. He used a composite FB and 4 LEDs. With LEGO Mindstorms (LMS) with touch sensor as a button, there are only 3 sensor connections left for LEDs. Current FORTE version used with LMS does not support composite FBs.

Testing Lesson:
Connecting a LED with a duplicate output can be used to see if an application sends a specific output event.

No comments:

Post a Comment