PDA

View Full Version : Vibrate and LED (something new for phone.ppl)


lopez1de
11-11-2008, 09:33 PM
Do you want rumbling in your games? Get this....


#ifdef _WIN32_WCE
#declare NLedSetDevice Coredll NLedSetDevice 2 0
#define NLED_SETTINGS_INFO_ID 2
#endif

proc LedVibrate(on$)
#ifdef _WIN32_WCE
local(on$, settings$);
struct(settings$, "LedNum", "OffOnBlink", "TotalCycleTime", "OnTime", "OffTime", "MetaCycleOn", "MetaCycleOff");
settings.LedNum$ = 1; //0=LED, 1=Vibrate
settings.OffOnBlink$ = on$; //0=off, 1=on
NLedSetDevice(NLED_SETTINGS_INFO_ID, &settings$);
#endif
end;

proc Vibrate(duration$)
//Vibrating for duration$ milliseconds
LedVibrate(true);
Sleep(duration$);
LedVibrate(false);
end;


Usage:


Vibrate(500); //vibrating 500ms



LED not tested yet. But should work also if you modify he code.

Nicknack
11-12-2008, 09:17 PM
thanks for contributing a new version sinceAndrew's one (forum.arianesoft.ca/showthread.php?t=1084) is already a bit outdated. btw for leds you haven't to tweak the code much (e.g. my leds are on 0 and 1 (no vibration)) and do you know the use of that MetaCycle?

lopez1de
11-13-2008, 08:23 AM
Oh, didn't noticed that Andrew has done this before. I wasted 2 hours of reading/writing. :rolleyes:

The msdn says:
TotalCycleTime
Total cycle time of a blink, in microseconds.
OnTime
On time of the cycle, in microseconds.
OffTime
Off time of the cycle, in microseconds.
MetaCycleOn
Number of on blink cycles.
MetaCycleOff
Number of off blink cycles.

http://msdn.microsoft.com/en-us/library/ms905326.aspx

But I never used it.