Miscellaneous > Programming & Networking
dos.h
TheQuirk:
i used delay because it usually goes below one second.
and most importantly, thanks!
[ August 01, 2002: Message edited by: TheQuirk ]
voidmain:
If you need a function like delay() you might then check out the nanosleep() function.
TheQuirk:
thanks, again. I'm just so used to programming in dos/windows... =\
voidmain:
You sparked my interest with your parallel port interests. I too have always wanted to get into building something that I could control from my computer but I have no electronics background. I decided to go pick up a breadboard, a handfull of LEDs, some wire and a DB25 connector. I built a cable to plug into my parallel port and wire up all the data pins and a ground to the breadboard. Stuck in 8 LEDs (Red, Green, and Yellow randomly).
Then I took the lptout.c example and an nsleep.c example (using usleep() to get the millisecond resolution) which gave the the necessary programs to include in a simple shell script to control the LEDs. I made the shell script so you could input the LED sequences interactively or put all of your LED commands in a file and loop through them to make cool christmas light patterns. My son made the light sequences. Here's the three pieces of code:
lptout.c:
--- Code: ---
--- End code ---
nsleep.c
--- Code: ---
--- End code ---
lights:
--- Code: ---
--- End code ---
Then:
# gcc -O -o lptout lptout.c
# chmod u+s lptout
$ gcc -o nsleep nsleep.c
$ chmod +x lights
Then to run the lights program interactively:
$ ./lights
If you want to have the script read the value/delay sequences from a file run it like:
$ ./lights lights.txt
Here is the "lights.txt" file my son came up with:
--- Code: ---
--- End code ---
Makes a good Christmas light sequence.
Thanks for sparking my interest. Now it's on to more interesting things like building a battle bot and writing a program to control it.. I am into R/C airplanes as well so I am trying to think of a way to use radio and computer control together.. Any ideas?
[ August 06, 2002: Message edited by: VoidMain ]
TheQuirk:
great little program
how much weight can one of the airplanes carry? maybe you could fit a small enough single board computer to automate various tasks? it would be a rather costly project, though...
By the way, the battle bots website has a TON of information on how to build your own robot, program it, etc.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version