For the first time I've been playing with Ubuntu past few days and love it.
I also dabble in PIC micros and was wondering after having seen how much you can do from simple commands in the Ubuntu terminal program, wouldn't it be possible to actually control a Linux PC somehow with a microcontroller -- by somehow interfacing the PIC to Ubuntu's terminal program (rs232?)?
The commands are simple ascii and they don't just run prgrams but control processes also.
On a sunny day (Mon, 27 Jul 2009 11:14:25 -0700 (PDT)) it happened mkr5000 wrote in :
You can control any Linux PC from a RS232 terminal. I still have an old RS232 terminal with CRT somewhere in the attic. If you were to program that PIC to wait for the prompt and then send one command at the time you can have the PC do anything. You may need to send a login and password too: Google 'linux RS232 terminal', you will find things like this:
I dunno about bubuntoo, but the instructions are generic.
Quite easy to do (modulo the need to parse the responses, of course). Do some reading on /etc/inittab and getty (probably implemented as agetty nowadays). May be as simple, on the PC side, as deleting one character in inittab.
WARNING - don't get too creative when working inside inittab. Bad Things can happen. Be sure that you have a Linux boot CD, your native flavor or Knoppix or something, if you've not fiddled with this before so that you can recover the original inittab (make a backup, of course).
If you uncomment those entries, then run "telinit q" to tell init to re-read the inittab file, you can log in via the serial port. To test it, you need another serial port (either on the same PC or a different PC, or a USB/serial converter) and a null-modem (crossover) cable (a modem cable won't work).
To connect a PIC to it, a PIC with a hardware UART is preferable, although you can bit-bang if you have to. You also need e.g. a MAX232 to convert between TTL and RS232 line levels.
You might want to run agetty with something like "-n -l /bin/bash" to skip the login, although that will give you a root shell. A custom script which does e.g. "exec su - guest" would be better.
While I think Linux is great, I do have to defend Windows here: Not only does it have the old "command prompt" (cmd.exe), but pretty much every *NIX shell has been ported to Windows if you'd like to use it, and there's 4NT/Take Command from JPSoft if you really want a fancy (but Windows-only) shell. Additionally, there's Microsoft's PowerShell, which is almost closer to something like a Perl or Python shell than a traditional command prompt.
Have you tried WinAmp?
If you find the equivalent of Street Atlas USA or Streets & Trips for Linux, let me know -- other than specific engineering programs, those are one major type of software that doesn't exist. (There are plenty of programs that provide routing and use Internet maps, but none where you can get accurate, up-to-date maps for the entire country, including routing information.)
Tomtom GPS units run on [embedded] Linux.You can buy recent maps on theri site, so the maps exist. You will have to reverse-engineer one for the soft that uses the maps (grab the flash perhaps), then there is the display issue. I seem to remember that there _are_ Linux programs that use standard maps you can buy. Been a while since I looked into that. There is always google maps and google earth. if you have a net connection. Else a compass:-) hehe
Perfectly good approach, but I'm not really all that interested in doing that myself -- I'd much rather pay someone, e.g., $50 to have already done so and then packaged it up nicely, like Delorme and Microsoft do.
"I seem to remember that there _are_ Linux programs that use standard maps you can buy."
I've never found any that run on general-purpose PCs/Linux distros, and I have looked a couple of times.
"There is always google maps and google earth. if you have a net connection."
If I were close enough to civilization to need a net connection, I probably wouldn't need a map.
I did miss a plane once after getting lost in Chicago some years ago, so Google maps definitely would have helped there. I've never gotten lost out in the woods to date, but that's what I worry about more. I was once out, by myself, for a day hike but miscalculated how long the return trip down the mountain would take and it ended up getting quite dark before I finished: Despite being at least a little bit prepared (I had a GPS receiver, lightweight jacket, matches, a small knife, etc., and a "AA"-powered LED flashlight -- which is what let me see enough of the trail to keep going --), I was getting pretty freaked out. Once I made it back to the car, I got some food at a local drive-through, returned to the motel, locked the door, ate dinner, and pretty quickly went to bed, feeling far less "adventurous" than when the day had started. :-)
Let's take the example of a simple music player to start.
I wasn't really aware that beyond the GUI you had access to other "functions" in the way that a program operates and this is what I noticed in Linux. (or was I seeing things?)
I mean there are some occasions where, unlike Windows, to get something done you go to the Linux terminal and type in commands -- for an assortment of reasons.
I'm sort of lost regarding software when it comes to what lies between the end product (the GUI) and actual programming. I mean, I can write a good amount of VBNET and I can certainly click a mouse in a GUI but "shells" and commands are an area that I have never entered. (except dos, I suppose).
Going back to my audio player example -- I know that it would be easy enough in any op system to start and stop the "program" with commands -- but do (you think) I also have commands available to control volume, stop, play etc?
With root privilege, crashing the system is fairly easy (it used to be as simple as "cat /dev/zero > /dev/kmem" - overwrite kernel memory with zeros, but that feature tends to be disabled in modern kernels).
Without root privilege, the easiest way to crash the system is with 3D games. The drivers for the 3D part of the video hardware tend to be permanently alpha-quality, as the hardware tends to become obsolete long before most of the bugs get fixed.
On a sunny day (Tue, 28 Jul 2009 06:20:13 -0700 (PDT)) it happened mkr5000 wrote in :
It all depends on the application. For a music player, to control volume, you can use a mixer, an other application... Can be as simple as using the amix program, use amixer -c 0 scontrols to get the simple controls.
Then you can for example do:
Set volume to 100%: amixer -c 0 sset 'Master',0 100
Set volume to 10%: amixer -c 0 sset 'Master',0 10
In my view, controlling a PC from a PIC makes little sense, as you can automate anything and everything on the PC itself (and have a real time clock at your disposal too) with scripts for example.
Consider creating this text, with an [any] editor:
Now make it executable (any filename can be made executable in Linux). chmod +x my_test.
Start your music player. Now type, in some terminal: my_test. Enjoy.
Suggestion to read; man amixer man chmod man bash man ...anything...
An other useful command, if you have no clue, is the 'apropos' command to find references to what you want to know: apropos clue
I dunno if you can write in C, if you do I can recommend the very simple but also very powerful xforms library, it has the program 'fdesign' that will create C code for the GUI and all you then have to do is write the functions you want and fill in the callbacks.
Takes 10 minutes or less to set up a simple GUI program with that. The GUI program can then call other programs, for example mpg123 (mp3 player) can be called from that GUI if it is supposed to be a music player, etc..
The other thing you need to know about is pipes in Unix, as it allows you to send the output of one program to the input of an other one, allowing you to chain programs together to do operations on data. cat *.txt | grep hello
The '|' symbol is a pipe. man cat man grep
Maybe, if all fails, look for a good online book about Unix / Linux, look at the source code of
programs for how people do it, that is another advantage of open source. Give it a few years :-)
Building one's own MP3 player is a pretty popular project... you might want to take a look at what others have done too. E.g.,:
...Google can find many others.
Note that a regular old PIC doesn't have the power to decode an MP3 bitstream -- the various PIC/AVR controlled MP3 players you see out there tend to use a dedicated IC to perform the (computationally intensive) decode.
"The middle of nowhere" is *well* within the ~300 mile range of a car. :-)
At least in most parts of the country.
Most people who get lost in the woods (granted, on foot) are no more than 5 miles from a major road. (Although just finding "a road" isn't always a lot of help if you can't discern a road leading back to civilization from some old logging road that is seldom used...... this was the mistake James Kim made, turning from a lesser-used [but at least paved, named and reasonably well-known] road onto a logging road...).