Skip to main content

Posts

Showing posts from September, 2008

Arduino Accelerometer (ADXL330)

Another toy I ordered quite awhile ago was an accelerometer. Just hooked it up, no sweat. Here's the code: #define xPin 5 #define yPin 4 #define zPin 3 int x = 0; int y = 0; int z = 0; int delta = 0; void setup() { Serial.begin(9600); } void loop() { delta = x + y + z; x = analogRead(xPin); y = analogRead(yPin); z = analogRead(zPin); delta -= x + y + z; Serial.print(x); Serial.print(", "); Serial.print(y); Serial.print(", "); Serial.print(z); Serial.print(", "); Serial.println(abs(delta)); delay(500); }
Read more

Arduino RF Link

I bought two RF links from SparkFun a while back (a 315Mhz and a 434Mhz ). A few nights ago, I actually hooked one of them up and successfully ran a test program between two Arduinos. Here's the code for the receiver: #define rxPin 2 #define txPin 3 byte incomingByte = 0; SoftwareSerial rfSerial = SoftwareSerial(rxPin, txPin); void setup() { pinMode(rxPin, INPUT); pinMode(txPin, OUTPUT); rfSerial.begin(2400); Serial.begin(2400); } void loop() { incomingByte = rfSerial.read(); Serial.println(incomingByte, DEC); incomingByte = 0; } And for the transmitter: #define rxPin 2 #define txPin 3 SoftwareSerial rfSerial = SoftwareSerial(rxPin, txPin); byte outgoingByte = 0; void setup() { pinMode(rxPin, INPUT); pinMode(txPin, OUTPUT); rfSerial.begin(2400); Serial.begin(2400); } void loop() { Serial.println(outgoingByte, DEC); rfSerial.println(outgoingByte, BYTE); outgoingByte++; delay(10); } Pretty simple. It just sends the numbers 0-255 repeatedly and prints them out to seria...
Read more

How to Run Rise of Nations with Wine

I spent quite a while last night getting Rise of Nations Golden Edition running on Ubuntu Ibex. Here's what it took: Part 1: Make CD images using Cdrdao Cdrdao is used for dumping images of CDs in .bin/.toc format. Normally dd is enough to make an image. But, for copy-protected discs like RoN, you need something a little stronger. Here's the command I used to make images of both discs: $ cdrdao read-cd --read-raw --datafile image.bin \ --device /dev/cdrw2 --driver generic-mmc-raw image.toc Be sure to replace /dev/cdrw2 with your CDROM device. Part 2: Mount the images using CDemu Windows users are probably familiar with DAEMON Tools. CDemu is the equivalent for Linux. There are nice Debian packages available . Download and install, in order: vhba-dkms libmirage cdemu-daemon cdemu-client Mounting the images after installing CDemu is simple. $ cdemu load 0 image.toc Part 3: Update and configure Wine The standard Ubuntu repositories do not have the most up-to-date version of Wine...
Read more

How to Combine AVIs in Ubuntu

Here's a tiny bash function I wrote to do it with mencoder ( sudo apt-get install mencoder ): function combineavis() { read -p "Combined AVI name: " -e output mencoder "$@" -o "$output" -ovc copy -oac copy } I also found this page (which has quite a few handy snippets about lots of various Linux tasks). It recommends using avimerge -o "$output" -i "$@" instead.
Read more

Backing Up and Resizing Partitions in Linux

I just finished reorganizing my partition scheme and it was surprisingly painless. Originally, I had two 75GB, 10K Raptors. I installed Ubuntu on the first and Windows XP on the second. I was careful to keep the Windows drive pristine and use Grub to handle the dual booting. That way, I could always simply change my drive boot order in BIOS to boot into Windows if something happened to my Ubuntu drive or Grub. That was two years ago. In that time, I booted into Windows only once or twice. So, I decided to take better advantage of the other drive. The original setup was something like this: /dev/sda1 -> /boot /dev/sda2 -> swap /dev/sda3 -> / /dev/sda4 -> /home /dev/sdb1 -> Windows XP First, I backed up the Windows drive using dd just in case I wanted to recreate it sometime down the road. $ dd if=/dev/sdb1 | gzip -c | split -b 2000m - /media/backup/wxp.img.gz. Now it's easy to restore it later. $ cat /media/backup/wxp.img.gz.* | gzip -dc | dd of=/dev/sdb1 I also back...
Read more