Registers

Hi,

Yes, I'm pretty sure it will need to change.

I think that all the code is doing is setting an output to LOW, followed by a short delay, setting the output HIGH and delaying again. The output is pin 4 of the AVR's C port. Presumably this pin was connected to whatever pin on the sensor that wakes it up.

In Arduino style, this would be:

void wakeSensor () {
  Wire.end (); // does this command exist?
  pinMode (sensorWakePin, OUTPUT);
  digitalWrite (sensorWakePin, LOW);
  delay (1);
  digitalWrite (sensorWakePin, HIGH);
  delay (1);
  Wire.begin ();
}

The only line I'm not sure about is " TWCR &= ~(1<<2);". I think it maybe disabling the i2c interface. I don't know what the Arduino command for that is. Logically it would be Wire.end () but I don't see that command listed with the other i2c commands.

Paul