Running LCD display + LEDs at the same time
RobertW
Posts: 66
I believe this question could be in the area of Propeller cogs 101 but I am still having a little trouble getting what I am looking for.· As a 'learning exercise' I am trying to print 'Initializing' then a series of periods (.) after that for about·5 times.· At the same time I would like to blink some LEDs.· The pattern of the LEDs is not important at this point and flashing one after the other is fine.· Each works fine seperately but not combined.· I'm thinking that I need to start the next cog and run the LCD in 1 cog and the LEDs in another cog.· This is my current setup:
Main program
······ - LCD object
······ - LEDs object
The main program initializes the LCD and calls different methods as required.· The same with the LCD object.· Any suggestions on how to properly start·the LCD·in it's own cog?· I think I can figure out the LEDs.
Since I need to initialize the LCD, print the 'Initalizing' method, and then print different messages later in the program, how should I keep the LCD cog running?· If I understand cogs correctly, they will stop when they run out of code.· How do you prevent this while waiting to receive a message from the main object?· Would I need some sort of repeat loop?
Thank you.
-Robert W
Main program
······ - LCD object
······ - LEDs object
The main program initializes the LCD and calls different methods as required.· The same with the LCD object.· Any suggestions on how to properly start·the LCD·in it's own cog?· I think I can figure out the LEDs.
Since I need to initialize the LCD, print the 'Initalizing' method, and then print different messages later in the program, how should I keep the LCD cog running?· If I understand cogs correctly, they will stop when they run out of code.· How do you prevent this while waiting to receive a message from the main object?· Would I need some sort of repeat loop?
Thank you.
-Robert W
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon McPhalen
Hollywood, CA
Thanks for the reply.· I probably did not explain what I was trying to do very well, but yes, your question is exactly what I am trying to do.· I would like to print something on the display and flash the LEDs at the same time.· It is my understanding that I can try to time the two with a repeat loop or start one of them in a new cog.· Is this correct?
Thanks.
This is a flexible routine, allowing you to specify the pin, on- and off-timing (in milliseconds, for duty cycle), and the number of flashes. If you call this like a regular method it will "block" the main program. You can launch it into its own cog if you choose, but you may want to add cogstop at the end.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon McPhalen
Hollywood, CA