Forum Rule: Always post complete source code & details to reproduce any issue!
Page 2 of 2 FirstFirst 1 2
Results 26 to 35 of 35

Thread: Teensyduino 1.23 Beta #2 Available

  1. #26
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,704
    Nantonos beat me to it - I've had much better IDE behavior on Windows with 1 or more active installs - using the ZIP copy method - and through the flurry of 1.6.0,1,2,3,4 that says a lot on 3 Windows 7&8 mix of machines.

    Also the PJRC ILI9341's SD slot has been hacked to work according to this diagram - I haven't tested yet: https://forum.pjrc.com/threads/28106...ll=1#post72904

  2. #27
    Hello,

    Don't know if it's my code or the new Teensy beta applied on Arduino IDE 1.6.4/MacOS X 10.7.5, but I got this error message after my first attempt to compile:

    /Applications/Arduino1.6.4+Teensy1.2.3.app/Contents/Java/hardware/teensy/avr/cores/teensy3/Print.h:66:9: note: no known conversion for argument 1 from 'double(double)' to 'long unsigned int'
    Erreur lors de la compilation.


    Code:
    #include <Wire.h>
    
    #define DEVICE1 (0x53) // Device address as specified in data sheet (SDO set to GND)
    #define DEVICE2 (0x1D) // Second Device address as specified in data sheet (SDO set to +3.3V)
    
    byte _buff[6];
    char POWER_CTL = 0x2D;    //Power Control Register
    char DATA_FORMAT = 0x31;
    char DATAX0 = 0x32;    //X-Axis Data 0
    char DATAX1 = 0x33;    //X-Axis Data 1
    char DATAY0 = 0x34;    //Y-Axis Data 0
    char DATAY1 = 0x35;    //Y-Axis Data 1
    char DATAZ0 = 0x36;    //Z-Axis Data 0
    char DATAZ1 = 0x37;    //Z-Axis Data 1
    int x1, y1, z1; // variables to hold final data for accel 1
    
    void setup()
    {
    
      Wire.begin(); // join i2c bus (address optional for master)
      Serial.begin(19200); // start serial for output. Make sure you set your Serial Monitor to the same!
      Serial.println("init");
      //Put the ADXL345 1 into +/- 4G range by writing the value 0x01 to the DATA_FORMAT register.
      newWriteTo(DATA_FORMAT, 0x01, DEVICE1);
      //Put the ADXL345 1 into Measurement Mode by writing 0x08 to the POWER_CTL register.
      newWriteTo(POWER_CTL, 0x08, DEVICE1);
      //Put the ADXL345 1 into +/- 4G range by writing the value 0x01 to the DATA_FORMAT register.
      newWriteTo(DATA_FORMAT, 0x01, DEVICE2);
      //Put the ADXL345 1 into Measurement Mode by writing 0x08 to the POWER_CTL register.
      newWriteTo(POWER_CTL, 0x08, DEVICE2);
    }
    
    void loop()
    {
      newReadAccel(); // read the x/y/z tilt on accelerometer
      delay(50); // read every 50 ms only
    }
    
    // function to read accelerometer data from chosen device using Wire library and send them to serial port
    void newReadAccel() {
      uint8_t howManyBytesToRead = 6;
      newReadFrom(DATAX0, howManyBytesToRead, _buff, DEVICE1); //function call to read the acceleration data from the ADXL345
      // each axis reading comes in 10 bit resolution, ie 2 bytes. Least Significat Byte first!!
      // thus we are converting both bytes in to one int
      x1 = (((int)_buff[1]) << 8) | _buff[0];
      y1 = (((int)_buff[3]) << 8) | _buff[2];
      z1 = (((int)_buff[5]) << 8) | _buff[4];
    
      Serial.print("x1: ");
      Serial.print( x1 );
      Serial.print(" y1: ");
      Serial.print( y1 );
      Serial.print(" z1: ");
      Serial.print( z1 );
    
      delay(2);
    }
    
    // newWriteTo function to write data into I2C devices with chosen device address
    void newWriteTo(byte address, byte val, char device) {
      Wire.beginTransmission(device); // start transmission to device
      Wire.write(address); // send register address
      Wire.write(val); // send value to write
      Wire.endTransmission(); // end transmission
    }
    
    // newReadFrom Function to read num bytes starting from address register on chosen device in to _buff array
    void newReadFrom(byte address, int num, byte _buff[], char mydevice) {
      Wire.beginTransmission(mydevice); // start transmission to device
      Wire.write(address); // sends address to read from
      Wire.endTransmission(); // end transmission
      Wire.beginTransmission(mydevice); // start transmission to device
      Wire.requestFrom(mydevice, num); // request 6 bytes from device
      int i = 0;
      while(Wire.available()) // device may send less than requested (abnormal)
      {
        _buff[i] = Wire.read(); // receive a byte
        i++;
      }
      Wire.endTransmission(); // end transmission
    }
    
    // low-pass (smooth) function
    int smooth(int data, float filterVal, float smoothedVal){
    
    
      if (filterVal > 1){      // check to make sure param's are within range
        filterVal = .99;
      }
      else if (filterVal <= 0){
        filterVal = 0;
      }
    
      smoothedVal = (data * (1 - filterVal)) + (smoothedVal  *  filterVal);
    
      return (int)smoothedVal;
    }

  3. #28
    I have tried to compile the same code on an older IDE (Arduino 1.06 and Teensy 1.213).

    The error messages are much more precise:

    MebiiiSpring2015-TestAccelerometer.ino:30:9: error: 'int y1' redeclared as different kind of symbol
    In file included from /Applications/Arduino106+Teensy121.app/Contents/Resources/Java/hardware/teensy/cores/teensy3/WProgram.h:6:0,
    from /Applications/Arduino106+Teensy121.app/Contents/Resources/Java/hardware/teensy/cores/teensy3/Arduino.h:1,
    from /Applications/Arduino106+Teensy121.app/Contents/Resources/Java/libraries/Wire/Wire.h:26,
    from MebiiiSpring2015-TestAccelerometer.ino:17:
    /Applications/Arduino106+Teensy121.app/Contents/Resources/Java/hardware/tools/arm/arm-none-eabi/include/math.h:469:15: error: previous declaration of 'double y1(double)'
    extern double y1 _PARAMS((double));
    ^
    MebiiiSpring2015-TestAccelerometer.ino: In function 'void newReadAccel()':
    MebiiiSpring2015-TestAccelerometer.ino:57:6: error: assignment of function 'double y1(double)'
    MebiiiSpring2015-TestAccelerometer.ino:57:6: error: cannot convert 'int' to 'double(double)' in assignment


    The line pointed to is this one:
    Code:
    y1 = (((int)_buff[3]) << 8) | _buff[2];
    I still don't know whether it's my code or the IDE, but I am almost sure it ran flawlessly on another board previously (Arduino Pro Mini).

  4. #29
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,576
    That error seems to say you've also got a function named "y1" in the rest of your code (which you didn't post).

    Obviously, if you name a variable the same as a function, that's going to confuse the compiler when you try to use the variable.

  5. #30
    Quote Originally Posted by PaulStoffregen View Post
    That error seems to say you've also got a function named "y1" in the rest of your code (which you didn't post).

    Obviously, if you name a variable the same as a function, that's going to confuse the compiler when you try to use the variable.
    The complete code is in the previous message and I don't see where I define y1 as a function...

    ???

  6. #31
    Senior Member
    Join Date
    Jan 2015
    Location
    frisia
    Posts
    285
    Try reading the error message it states where it can be found
    previous declaration of 'double y1(double)'
    y1 is one of the bessel functions

  7. #32
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,422
    Actually it is defined internal to the compiler. If you look at the error message:
    from Test.ino:1:
    c:\arduino-1.6.4\hardware\tools\arm\arm-none-eabi\include\math.h:469:15: error: previous declaration of 'double y1(double)'
    extern double y1 _PARAMS((double));
    ^
    And if you look at math.h it defines several externs, like:
    extern double y0 _PARAMS((double));
    extern double y1 _PARAMS((double));
    extern double yn _PARAMS((int, double));
    extern double j0 _PARAMS((double));
    extern double j1 _PARAMS((double));
    extern double jn _PARAMS((int, double));

  8. #33
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,576
    Oh, yes, I didn't catch that. Looks like math.h defines y1.

    But avr-libc's math.h doesn't define this (and a LOT of other stuff).

    Maybe Teensyduino should trim some of the math.h stuff that's so likely to conflict? The other common conflict seems to be "gamma".

  9. #34
    Quote Originally Posted by KurtE View Post
    Actually it is defined internal to the compiler. If you look at the error message:


    And if you look at math.h it defines several externs, like:
    So it's just a conflicting variable name ?

    By the way why is Arduino IDE 1.0.6 so much more talkative about compilation errors than 1.6.4 ?

  10. #35
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,576
    1.0.x and 1.6.x use separate prefs. Look at File > Preferences on both. Perhaps you have different settings? Maybe the "verbose info while compiling" setting?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •