Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 01-26-2012, 10:49 AM   #1 (permalink)
Registered Member
 
Join Date: Jul 2010
Posts: 25
veterinarian2008 is on a distinguished road
Default SOS For LED or Flash

Hey guys!

I need some help on getting SOS flashing on the LED.

I have the strobe working but how do I get the flash to do it at a specific set of intervals?

Thank you. BTW I know what is NSTimer on the docs but my question is how do I do it for the LED.
veterinarian2008 is offline   Reply With Quote
Old 01-26-2012, 11:49 AM   #2 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,003
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by veterinarian2008 View Post
Hey guys!

I need some help on getting SOS flashing on the LED.

I have the strobe working but how do I get the flash to do it at a specific set of intervals?

Thank you. BTW I know what is NSTimer on the docs but my question is how do I do it for the LED.
Post the code that you wrote to turn on and off the torch.

You're trying to send SOS in Morse code?

That would take some design work.

I'd create an array of on/off states (NSNumbers containing booleans), and an array of durations (NSNumbers containing floats). You'd need to fill the arrays with the correct values for the dot-dash patterns to flash SOS, and include pauses between the letters.

Code:
State      Duration
on         short
off        short (pause)
on         short
off        short (pause)
on         short

off        long (inter-letter pause)

on         long
off        short (pause)
on         long
off        short (pause)
on         long

off        long (inter-letter pause)

on         short
off        short (pause)
on         short
off        short (pause)
on         short

off        extra long (turn off torch at end, and inter-word pause for repeat.)
I'd write a method that indexed into the array of states and set the torch to that on/off state, then started a 1-time timer at the specified duration interval that called the method again.

I'd use an instance variable to keep track of my place in the array of durations.

Once I reach the end of the array, I'd ether stop, or loop back to the beginning, depending on what I wanted to do.
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.

Last edited by Duncan C; 01-26-2012 at 11:52 AM.
Duncan C is offline   Reply With Quote
Old 01-26-2012, 12:34 PM   #3 (permalink)
Registered Member
 
Join Date: Jul 2010
Posts: 25
veterinarian2008 is on a distinguished road
Default

Thanks for the replay Duncan.

Okay, you can download the source code of this app. That is the code I am using:

http://www.Vellios.com/files/iStrobeSource.zip

I am not making another LED flashlight lol.

But I am using the very exact code of that app on my app.

Take a look at what they have if you can.
veterinarian2008 is offline   Reply With Quote
Old 01-26-2012, 01:02 PM   #4 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,003
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by veterinarian2008 View Post
Thanks for the replay Duncan.

Okay, you can download the source code of this app. That is the code I am using:

http://www.Vellios.com/files/iStrobeSource.zip

I am not making another LED flashlight lol.

But I am using the very exact code of that app on my app.

Take a look at what they have if you can.
I mentioned your SOS plans to my son, and he tells me he has an app that includes the ability to flash the LED (and screen) on his phone in a variety of patterns, including SOS. It's called AppBox Pro. It's a suite of mini-apps.

Did the plan i outlined make sense?
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is offline   Reply With Quote
Old 01-26-2012, 02:11 PM   #5 (permalink)
Registered Member
 
Join Date: Jul 2010
Posts: 25
veterinarian2008 is on a distinguished road
Default

Quote:
Originally Posted by Duncan C View Post
I mentioned your SOS plans to my son, and he tells me he has an app that includes the ability to flash the LED (and screen) on his phone in a variety of patterns, including SOS. It's called AppBox Pro. It's a suite of mini-apps.

Did the plan i outlined make sense?
Okay lol

Well sort of. I kind of get what you mean but not sure how should I start it.
veterinarian2008 is offline   Reply With Quote
Old 01-26-2012, 02:35 PM   #6 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,003
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by veterinarian2008 View Post
Okay lol

Well sort of. I kind of get what you mean but not sure how should I start it.
What part? Creating the arrays? Writing the method that turns the torch on and off and triggers the timer? The code that triggers the timer? All of it?
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is offline   Reply With Quote
Old 01-26-2012, 05:23 PM   #7 (permalink)
Registered Member
 
Join Date: Jul 2010
Posts: 25
veterinarian2008 is on a distinguished road
Default

Quote:
Originally Posted by Duncan C View Post
What part? Creating the arrays? Writing the method that turns the torch on and off and triggers the timer? The code that triggers the timer? All of it?

ahah! yea. Well, I get the abstract vision of what your telling me but I have no clue how to do the programing on that part. Setting the timers etc.

If you can help me get started on at least the first one, I can finish the rest. I am not asking you to, but if you want THAT WILL BE AWESOME! )

I wish I was as good as you guys that are replaying pretty much every thread! lol I will someday.

Thanks

EDIT: Also I just simply want to have a button with an SOS icon on and when they press that it will start flashing.
I don't care if is a different code to turn the torch on. (Preferably the one I am using tho)

Last edited by veterinarian2008; 01-26-2012 at 05:25 PM.
veterinarian2008 is offline   Reply With Quote
Old 01-26-2012, 08:33 PM   #8 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,003
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by veterinarian2008 View Post
ahah! yea. Well, I get the abstract vision of what your telling me but I have no clue how to do the programing on that part. Setting the timers etc.

If you can help me get started on at least the first one, I can finish the rest. I am not asking you to, but if you want THAT WILL BE AWESOME! )

I wish I was as good as you guys that are replaying pretty much every thread! lol I will someday.

Thanks

EDIT: Also I just simply want to have a button with an SOS icon on and when they press that it will start flashing.
I don't care if is a different code to turn the torch on. (Preferably the one I am using tho)
At this point in your learning, my typing out the code for you isn't really going to help you. I'd need to get it perfect, or it wouldn't work. To do that, I'd need to build a project and actually test it. I can create your project for you, but you're going to have to pay me for that, and I'm expensive.

You should buy a book on iOS programming and read it, doing the exercises as you go.
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is offline   Reply With Quote
Old 01-26-2012, 09:36 PM   #9 (permalink)
Registered Member
 
Join Date: Jul 2010
Posts: 25
veterinarian2008 is on a distinguished road
Default

Okay thanks!

I was actually going to ask you if I could pay you.

Whats your email? We can take on from there. Thanks.

mine is mortizvet@aol.com
veterinarian2008 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 389
10 members and 379 guests
Atatator, condor304, FrankWeller, glenn_sayers, iphonedevshani, MAMN84, mraalex, PowerGoofy, QuantumDoja, tim0504
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,674
Threads: 94,123
Posts: 402,908
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Atatator
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 05:54 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0