Pages: [1]   Go Down
Author Topic: 50/50 Background Pulse  (Read 485 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am starting a project, and the first thing that I need to do seems to be the most difficult, I need a constant background pulse
on for 110ms off for 110ms with very little change in the time throughout the program

what would be the best way of programming it so that it keeps that pulse, only on 1 pins (controlling an external relay)

Thanks
Logged

Southern California
Offline Offline
God Member
*****
Karma: 5
Posts: 539
I like blinky lights
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

For that level of precision I think you'll have to set up a timer and flip the pin state in the interrupt routine.

See the bottom code sample here for something close to what you want:

http://www.arduino.cc/playground/Code/Timer1

Good luck!
Logged

http://en.wiktionary.org/wiki/magagna <-- My last name.  Pretty apt.

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That seems to be working wonderfully

now if I need that to control something else (like when its on do this, when off do this) I can just use the if (pin used == HIGH) {do this} else if (pin used == LOW) {do this} correct?


I suppose I should explain my project a little bit, I am trying to build one of those floating message clocks (http://zedomax.com/blog/wp-content/uploads/2009/11/c778_ixp3_internet_messaging_clock.jpg)
I am tearing one down, and reworking it

I have figured out the frequency or oscillation, (thats what I needed the timer for)
Now I am trying to get it to display text (8-bit) from left to right (timer on) and then right to left (timer off)

I know that I will have to build a library with all of the letters to make life easier on myself

any help would be greatly appreciated
Logged

Southern California
Offline Offline
God Member
*****
Karma: 5
Posts: 539
I like blinky lights
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

"pin used" needs to be a global or static variable, or shorthand for digitalRead(pin used), but yes that will work.

Sounds like a cool project. Post a video when you're done!
Logged

http://en.wiktionary.org/wiki/magagna <-- My last name.  Pretty apt.

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

update on the project,

sorry its been so long, work and school have been consuming my time

I have the arduino sending the 50/50 pulse to a relay (HB Controls HBC-11-CMX60D10) which controls the swing arm

I then have functions set up for each letter of the alphabet (including spaces)

I have a for loop set up to loop 300 or so times (30 seconds) with some do loops in it that read the sensor at the edge of the swing arc

The first do while does nothing until the sensor is tripped, the second waits until it is not sensing the arm anymore then the actual call functions are there for the letters

After is has looped the 300 times it pauses for a second and moves to another for loop that controls the second set of text with the same setup

I will post samples of my code and videos once I get the whole thing working properly
Logged

Pages: [1]   Go Up
Jump to: