summaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2011-09-04 02:14:22 +0200
committerVegard Storheil Eriksen <zyp@jvnv.net>2011-09-04 02:14:22 +0200
commit5a6e0b83fbbc3d3841be3384d32c0d4d6aec070c (patch)
tree750283d1e082a7f2de3a353820e6e6c6d6892a83 /main.cpp
parentadb9868498b93f89ae875df764d475c9f5c16049 (diff)
Transmit gyro values over zigbee.
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/main.cpp b/main.cpp
index d9faac1..5a0cd4d 100644
--- a/main.cpp
+++ b/main.cpp
@@ -57,11 +57,24 @@ class PID {
}
};
+I2C i2c;
+ITG3200 gyro(i2c);
+
void threadmain() {
while(1) {
GPIOB.ODR ^= 1 << 1;
- xbee_send(3, (uint8_t*)"hei");
+ uint8_t buf[] = {
+ gyro.x & 0xff,
+ gyro.x >> 8,
+ gyro.y & 0xff,
+ gyro.y >> 8,
+ gyro.z & 0xff,
+ gyro.z >> 8,
+ };
+
+ xbee_send(6, buf);
+ Time::sleep(100);
}
}
@@ -84,10 +97,12 @@ int main() {
GPIOB.CRH = 0x44444444;
GPIOB.ODR = 1 << 1;
- I2C i2c;
+ Time::sleep(10);
+
+ //I2C i2c;
i2c.enable();
- ITG3200 gyro(i2c);
+ //ITG3200 gyro(i2c);
gyro.init();
PPMSum ppmsum;