|
samweps wrote:
how do you control LEDs in C#
By writing appropriate code for what you want to do.
What did you think the answer was going to be with a question like that??
In all seriousness, if you want to use C#, get a Netduino[^] or a FEZ Panda[^] microcontroller and learn how it's really done, without risking your computers expensive hardware. You'll also learn alot about digital electronics if you really want to teach yourself. Try getting this book[^] or this one[^].
|
|
|
|
|
it depends on what you need , if you have a Com ports you can use it easily with some hardware buffer and amplifier , or you can use any controllers, if you are not familiar with Arduino or PI , try to find a CanaKit board, its very easy and with LED's and Relayed output.
|
|
|
|
|
parallel port(DB25)
breadboard
optoisolator for each of the used lines(ie Protect the PC interface
next a latch (something to hold the data)
drivers (for lighting the lighty things)
opto latch
+Vcc
-----------------
r r r r r r r
e e e e e e e
s s s s s s s
i i i i i i i
db25 s s s s s s s
╔═╗latch sig t t t t t t t
-║-║------| o o o o o o o
║ ║ | r r r r r r r
║ ║ ╔═╗ ╔═╗ ╔═╗ | | | | | | |
-║-║-║o║-║l║----║d║--------------------o----|>-----o
-║-║-║p║-║a║----║r║-----------------o-------|>-----o
-║-║-║t║-║t║----║i║--------------o----------|>-----o
-║-║-║o║-║c║----║v║-----------o-------------|>-----o Ground
-║-║-║ ║-║h║----║e║--------o----------------|>-----o
-║-║-║ ║-║ ║----║r║-----o-------------------|>-----o
-║-║-║ ║-║ ║----║s║--o----------------------|>-----o
╚═╝ ╚═╝ ╚═╝ ╚═╝
each of the lines are attached to a pull up resistor
see C# parallel port programming on Code Project
|
|
|
|
|
hi, I would like directions on how to control LEDs through any ports in C#
|
|
|
|
|
Request you to not do resposts.
|
|
|
|
|
He can't. Once a question has an answer, it can't be deleted.
|
|
|
|
|
|
Is it still possible for a program to return a value to a command line BAT file ?
I'm thinking, a real simple square with two buttons, which return a 1 or a 0 value back to the command line that called it.
Can this be done ?
Is it simple ?
How is it done ?
Assuming I can do it, can I post the source code here on CodeProject ? Can I post the EXE ?
|
|
|
|
|
Only if it's an integer (32-bit). Yes. Yes. Look it up. Yes. No.
|
|
|
|
|
Look into "exit codes"
example[^]
Don't follow just one thread, read up on it a little, before jumping in.
|
|
|
|
|
I am beginner.
and I am going to make my own audio player without using "windows media player"
Please help me to finding me complete tutorial for making own audio player.
|
|
|
|
|
Chaman Saini wrote: and I am going to make my own audio player without using "windows media player"
Please help me to finding me complete tutorial for making own audio player.
I suggest you try the built-in class called "soundplayer[^]".
There's little chance that you'll find a "complete" tutorial on writing your own audio player. If you really want to use something else, try looking for an open-source library.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Request you not to repost.
|
|
|
|
|
|
Hello
I wanna ask that what is the reason that I am not able to play the mp3 file.
my whole code for the "class" for simple audio player is as below:-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace myplayer
{
class Player
{
[DllImport("winmm.dll")]
private static extern long mciSendString(string lpstrCommand, StringBuilder lpstrReturnString, int uReturnLength, int hwndCallback);
public void open(string file)
{
string command = "open\"" + file + "\" type mpegvideo alias MediaFile";
mciSendString(command, null, 0, 0);
}
public void play()
{
string command = "play MediaFile";
mciSendString(command, null, 0,0);
}
public void stop()
{
string command = "stop MediaFile";
mciSendString(command, null, 0, 0);
command = "close MediaFile";
mciSendString(command, null, 0, 0);
}
}
}
|
|
|
|
|
One obvious problem is that you don't have a space between open and the opening question mark of the file name in your open method.
|
|
|
|
|
please write your correct code here.
|
|
|
|
|
There's no need for that. What he described is spot on.
Look at the open command you're sending:
string command = "open\"" + file + "\" type mpegvideo alias MediaFile";
There is no space between the word "open" and the first quote mark where you sepcify the file name!
The result is your open command looks like this:
open"somefilename.mpg" type mpegvideo alias MediaFile
instead of this:
open "somefilename.mpg" type mpegvideo alias MediaFile
What do you think you have to do to fix that little problem??
|
|
|
|
|
hmmm Thank you so much Buddy.....
I am a beginner so i had face that problem
|
|
|
|
|
but it is still not workin.....I mean it is not playing............
What should I explain so that I can achieve more from you....
|
|
|
|
|
You're sending null in place of a buffer to hold any return information, so you're basically not getting any error information back from MCI.
You might also want to try removing the "type mpegvideo" from your command to see if that does anything.
|
|
|
|
|
You main problem is that you do not check the response from your mciSendString commands so you have no idea whether any of them have succeeded.
|
|
|
|
|
Recently, I had to track down why all of our new WPF screens were leaking memory. I rapidly dove into this issue and soon discovered that this issue was dispeared after I run the FOLLOWING code.
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
Does .net not call the method?
I use the GC.CollectionCount method to get the number of times garbage collection has occurred for the 0/1/2 generation of objects and find they were 211/196/9.
It means .net Does do it.
Can somone tell me why it is occured?
PS: I have a test by open and closing 10+ screens, my app consumed 200+MB from task manager. According to the .net memory profiler and ANTS memory profiler, the objects created by my screens have been actually collected.
I also tested that if we forced a GC(Garbage Collector) collect by above codes, the memory will be reduced obviously.
Thanks,
Michael.
GC;Memory Leak
modified 21-Feb-13 21:08pm.
|
|
|
|
|
Whenever you run GC.Collect() , only those objects that are not referenced anywhere are collected.
The numbers that you observe are those that are not cleared.
|
|
|
|
|
For the most part .net GC "just works" in .net, obviously this doesn't happen in all cases. It is rare to need to do an explicit GC. This[^] is probably worth a read. The most relevant part to this question is when GC takes place, to quote:
- The system has low physical memory.
- The memory that is used by allocated objects on the managed heap surpasses an acceptable threshold. This means that a threshold of acceptable memory usage has been exceeded on the managed heap. This threshold is continuously adjusted as the process runs.
- The GC.Collect method is called. In almost all cases, you do not have to call this method, because the garbage collector runs continuously. This method is primarily used for unique situations and testing.
When one of these happens, GC takes place.
If you do something that takes up a lot of memory then it can be a good idea to GC, but it is generally discouraged. This is really a tuning thing and depends on your app, if the performance is degraded then you probably do need it.
Hope this answers your question.
|
|
|
|