New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hexbright.cpp fails to compile on ubuntu 12.04.1 "precise" #17

Closed
eichin opened this Issue Feb 1, 2013 · 4 comments

Comments

Projects
None yet
3 participants
@eichin

eichin commented Feb 1, 2013

Wire.h comes from arduino-core 1:1.0+dfsg-9.

hexbright/libraries/hexbright/hexbright.cpp: In static member function 'static void hexbright::read_accelerometer()':
hexbright/libraries/hexbright/hexbright.cpp:634:28: error: call of overloaded 'write(int)' is ambiguous
/usr/share/arduino/libraries/Wire/Wire.h:55:20: note: candidates are: virtual size_t TwoWire::write(uint8_t)
/usr/share/arduino/hardware/arduino/cores/arduino/Print.h:49:12: note:                 size_t Print::write(const char*)
hexbright/libraries/hexbright/hexbright.cpp:635:31: error: no matching function for call to 'TwoWire::endTransmission(int)'
/usr/share/arduino/libraries/Wire/Wire.h:52:13: note: candidate is: uint8_t TwoWire::endTransmission()
hexbright/libraries/hexbright/hexbright.cpp: In static member function 'static unsigned char hexbright::read_accelerometer(unsigned char)':
hexbright/libraries/hexbright/hexbright.cpp:659:31: error: no matching function for call to 'TwoWire::endTransmission(int)'
/usr/share/arduino/libraries/Wire/Wire.h:52:13: note: candidate is: uint8_t TwoWire::endTransmission()

This diff actually gets it to compile, and is enough to make at least tactical.ino actually work on the hexbright...

diff --git a/libraries/hexbright/hexbright.cpp b/libraries/hexbright/hexbright.cpp
index 0e0eee9..f57e084 100755
--- a/libraries/hexbright/hexbright.cpp
+++ b/libraries/hexbright/hexbright.cpp
@@ -631,8 +631,8 @@ void hexbright::read_accelerometer() {
   next_vector();
   while(1) {
     Wire.beginTransmission(ACC_ADDRESS);
-    Wire.write(ACC_REG_XOUT);          // starting with ACC_REG_XOUT,
-    Wire.endTransmission(false);
+    Wire.write(ACC_REG_XOUT, sizeof(ACC_REG_XOUT));          // starting with ACC_REG_XOUT,
+    Wire.endTransmission();
     Wire.requestFrom(ACC_ADDRESS, 4);  // read 4 registers (X,Y,Z), TILT
     for(int i=0; i<4; i++) {
       if (!Wire.available())
@@ -656,7 +656,7 @@ unsigned char hexbright::read_accelerometer(unsigned char acc_reg) {
   if (!digitalReadFast(DPIN_ACC_INT)) {
     Wire.beginTransmission(ACC_ADDRESS);
     Wire.write(acc_reg);
-    Wire.endTransmission(false);       // End, but do not stop!
+    Wire.endTransmission();       // End, but do not stop!
     Wire.requestFrom(ACC_ADDRESS, 1);
     return Wire.read();
   }
@wbattestilli

This comment has been minimized.

wbattestilli commented Feb 1, 2013

The Arduino package provided by precise is too old. You need to use Arduino 1.0.2 or later.

@dhiltonp

This comment has been minimized.

Owner

dhiltonp commented Feb 1, 2013

If I understand correctly, you are running arduino 1.0? I have verified functionality with arduino back to version 1.0.1

@eichin

This comment has been minimized.

eichin commented Feb 1, 2013

Looking at https://launchpad.net/ubuntu/precise/i386/arduino-core and https://launchpad.net/ubuntu/quantal/i386/arduino-core it looks like Precise has 1.0, quantal has 1.0.1, and precise-backports has 1.0.1. Might be worth noting in the top level readme (quantal is current but precise is LTS, ie the long-term-support version.) Thanks.

@dhiltonp

This comment has been minimized.

Owner

dhiltonp commented Feb 1, 2013

I've added additional information on linux setup to the main readme.

@dhiltonp dhiltonp closed this Jun 25, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment