[Solved] error compiling - don´t use byte y0/y1

Discussion in 'Arduino IDE' started by lecktricker, Nov 11, 2013.

  1. lecktricker

    lecktricker New Member

    Joined:
    Oct 28, 2013
    Messages:
    3
    Likes Received:
    0
    Hi,

    can anyone give me a hint or a guide to solve this issue.
    I have written a small program to control a 8x8 RGB Matrix and the code works fine on my Arduino Mega. I checked and compiled the code on my Win7 with Arduino 1.5.4 as well. The problem is if i compile the code with Udoo i get a lot of errors. I don´t think is code related, but i have no idea what happens and why.

    Code to complie
    Code:
      // ##### Define #####  ##### Define #####  ##### Define ##### 
    byte sendByte = 0;
    byte incomingByte;
    byte y = 0;
    byte r = 0;
    byte g = 0;
    byte b = 0;
    int dataPin = 4;
    int latchPin = 5;
    int clockPin = 6;
    int i = 0;
    int randomtimer =0;
    
    
    byte y0 = 0b11111111;
    byte y1 = 0b11111110;
    byte y2 = 0b11111101;
    byte y3 = 0b11111011;
    byte y4 = 0b11110111;
    byte y5 = 0b11101111;
    byte y6 = 0b11011111;
    byte y7 = 0b10111111;
    byte y8 = 0b01111111;
    
    byte r0 = 0b11111111;
    byte r1 = 0b11111110;
    byte r2 = 0b11111101;
    byte r3 = 0b11111011;
    byte r4 = 0b11110111;
    byte r5 = 0b11101111;
    byte r6 = 0b11011111;
    byte r7 = 0b10111111;
    byte r8 = 0b01111111;
    
    byte g0 = 0b11111111;
    byte g1 = 0b11111110;
    byte g2 = 0b11111101;
    byte g3 = 0b11111011;
    byte g4 = 0b11110111;
    byte g5 = 0b11101111;
    byte g6 = 0b11011111;
    byte g7 = 0b10111111;
    byte g8 = 0b01111111;
    
    byte b0 = 0b11111111;
    byte b1 = 0b11111110;
    byte b2 = 0b11111101;
    byte b3 = 0b11111011;
    byte b4 = 0b11110111;
    byte b5 = 0b11101111;
    byte b6 = 0b11011111;
    byte b7 = 0b10111111;
    byte b8 = 0b01111111;
    
    
    // ##### Stetup #####  ##### Stetup #####  ##### Stetup #####
    void setup() {
      Serial.begin(9600);  
      //set pins to output so you can control the shift register
      pinMode(latchPin, OUTPUT);
      pinMode(clockPin, OUTPUT);
      pinMode(dataPin, OUTPUT);
    
      Led(y0,r0,g0,b0);
      delay(100);
    
    }
    
    // ##### Loop #####  ##### Loop #####  ##### Loop #####
    void loop() {
    
      // send data only when you receive data:
      if (Serial.available() > 0) {
        // read the incoming byte:
        incomingByte = Serial.read();
    
        // say what you got:
        Serial.print("I received: ");
        Serial.println(incomingByte, BIN);
        Serial.print("I sended: "); 
        Serial.println(sendByte);
      }
      else {
    
        //    do on fail 
      }
    
      if (randomtimer<=1)
      {
        int randomtimer = 200;
    
        //    Led(random(0,255),random(0,255),random(0,255),random(0,255));
    
        //roter Punkt oben links nach rechts unten
        Led(r0,255,255,y0);
        delay(randomtimer);
        Led(r1,255,255,y1);
        delay(randomtimer);
        Led(r2,255,255,y2);
        delay(randomtimer);
        Led(r3,255,255,y3);
        delay(randomtimer);
        Led(r4,255,255,y4);
        delay(randomtimer);
        Led(r5,255,255,y5);
        delay(randomtimer);
        Led(r6,255,255,y6);
        delay(randomtimer);
        Led(r7,255,255,y7);
        delay(randomtimer);
        Led(r8,255,255,y8);
        delay(randomtimer);
    
        //grüner Punkt rechts unten nach links oben
        Led(r0,g8,255,y8);
        delay(randomtimer);
        Led(r0,g7,255,y7);
        delay(randomtimer);
        Led(r0,g6,255,y6);
        delay(randomtimer);
        Led(r0,g5,255,y5);
        delay(randomtimer);
        Led(r0,g4,255,y4);
        delay(randomtimer);
        Led(r0,g3,255,y3);
        delay(randomtimer);
        Led(r0,g2,255,y2);
        delay(randomtimer);
        Led(r0,g1,255,y1);
        delay(randomtimer);
        Led(r0,g0,255,y0);
        delay(randomtimer);
    
        //blau balken rechts nach links
        Led(r0,g0,b8,0);
        delay(randomtimer);
        Led(r0,g0,b7,0);
        delay(randomtimer);
        Led(r0,g0,b6,0);
        delay(randomtimer);
        Led(r0,g0,b5,0);
        delay(randomtimer);
        Led(r0,g0,b4,0);
        delay(randomtimer);
        Led(r0,g0,b3,0);
        delay(randomtimer);
        Led(r0,g0,b2,0);
        delay(randomtimer);
        Led(r0,g0,b1,0);
        delay(randomtimer);
    
        //blau balken unten nach oben
        Led(r0,g0,0,y8);
        delay(randomtimer);
        Led(r0,g0,0,y7);
        delay(randomtimer);
        Led(r0,g0,0,y6);
        delay(randomtimer);
        Led(r0,g0,0,y5);
        delay(randomtimer);
        Led(r0,g0,0,y4);
        delay(randomtimer);
        Led(r0,g0,0,y3);
        delay(randomtimer);
        Led(r0,g0,0,y2);
        delay(randomtimer);
        Led(r0,g0,0,y1);
        delay(randomtimer);
    
    
        for(int z=0; z <=5; z++){
          //random einfarbig
          Led(random(0,255),255,255,random(0,255));
          delay(randomtimer);
          Led(255,random(0,255),255,random(0,255));
          delay(randomtimer);
          Led(255,255,random(0,255),random(0,255));
          delay(randomtimer);
        }
    
        for(int z=0; z <=5; z++){
          //random zweifarbig
          Led(random(0,255),random(0,255),255,random(0,255));
          delay(randomtimer);
          Led(255,random(0,255),random(0,255),random(0,255));
          delay(randomtimer);
          Led(random(0,255),255,random(0,255),random(0,255));
          delay(randomtimer);
        }
        for(int z=0; z <=5; z++){
          //random mehrfarbig
          Led(random(0,255),random(0,255),random(0,255),random(0,255));
          delay(randomtimer);
          Led(random(0,255),random(0,255),random(0,255),random(0,255));
          delay(randomtimer);
          Led(random(0,255),random(0,255),random(0,255),random(0,255));
          delay(randomtimer);
        }
    
        for(int z=0; z <=10; z++){
          //random chaos
          Led(random(0,255),random(0,255),random(0,255),0);
          delay(randomtimer);
          Led(random(0,255),random(0,255),random(0,255),0);
          delay(randomtimer);
          Led(random(0,255),random(0,255),random(0,255),0);
          delay(randomtimer);
        }
    
        for(int z=0; z <=10000; z++){
          greeper();
        }
    
    
        randomtimer++;  
      }
      else
      {
    
      } 
    
    }
    
    // ##### Funktionen #####  ##### Funktionen #####   ##### Funktionen ##### 
    void Led(byte r,byte g,byte b, byte y)
    {
      digitalWrite(latchPin, LOW);
      shiftOut(dataPin, clockPin, MSBFIRST, y); 
      shiftOut(dataPin, clockPin, MSBFIRST, b); 
      shiftOut(dataPin, clockPin, MSBFIRST, g); 
      shiftOut(dataPin, clockPin, MSBFIRST, r); 
      //  Serial.print("R: ");
      //  Serial.print(r);
      //  Serial.print(" B: ");
      //  Serial.println(b);
      digitalWrite(latchPin, HIGH);
    
    }
    
    // ##### Animation #####  ##### Animation #####   ##### Animation ##### 
    void greeper()
    {
      //start oben links
    
    
      if (i>100)
      {
        for(int z=0; z <=100; z++){
          Led(r0,0b00000000,b0,y1);
          Led(0b10011001,0b01100110,b0,y2);
          Led(0b10011001,0b01100110,b0,y3);
          Led(r0,0b00000000,b0,y4);
          Led(r0,0b00011000,b0,y5);
          Led(r0,0b00111100,b0,y6);
          Led(r0,0b00100100,b0,y7);
          Led(r0,0b00000000,b0,y8);
          Led(r0,0b00000000,b0,y0);
        }
        i =0;
      }
      else 
      {
        Led(r0,0b00000000,b0,y1);
        Led(r0,0b01100110,b0,y2);
        Led(r0,0b01100110,b0,y3);
        Led(r0,0b00000000,b0,y4);
        Led(r0,0b00011000,b0,y5);
        Led(r0,0b00111100,b0,y6);
        Led(r0,0b00100100,b0,y7);
        Led(r0,0b00000000,b0,y8);
        Led(r0,0b00000000,b0,y0);
    
        i++;
      }
    
    }
    
    
    Error Message
    Code:
    /home/ubuntu/arduino-1.5.4/hardware/tools/arm-none-eabi/bin/arm-none-eabi-g++ -c -g -Os -w -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -Dprintf=iprintf -mcpu=cortex-m3 -DF_CPU=84000000L -DARDUINO=154 -DARDUINO_SAM_DUE -DARDUINO_ARCH_SAM -D__SAM3X8E__ -mthumb -DUSB_VID=0x2341 -DUSB_PID=0x003e -DUSBCON -DUSB_MANUFACTURER="Unknown" -DUSB_PRODUCT="Arduino Due" -I/home/ubuntu/arduino-1.5.4/hardware/arduino/sam/system/libsam -I/home/ubuntu/arduino-1.5.4/hardware/arduino/sam/system/CMSIS/CMSIS/Include/ -I/home/ubuntu/arduino-1.5.4/hardware/arduino/sam/system/CMSIS/Device/ATMEL/ -I/home/ubuntu/arduino-1.5.4/hardware/arduino/sam/cores/arduino -I/home/ubuntu/arduino-1.5.4/hardware/arduino/sam/variants/arduino_due_x /tmp/build2908918857041739047.tmp/_8x8RGB_V5.cpp -o /tmp/build2908918857041739047.tmp/_8x8RGB_V5.cpp.o 
    _8x8RGB_V5.ino:23:6: error: 'byte y0' redeclared as different kind of symbol
    /home/ubuntu/arduino-1.5.4/hardware/tools/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.6.2/../../../../arm-none-eabi/include/math.h:448:15: error: previous declaration of 'double y0(double)'
    _8x8RGB_V5.ino:24:6: error: 'byte y1' redeclared as different kind of symbol
    /home/ubuntu/arduino-1.5.4/hardware/tools/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.6.2/../../../../arm-none-eabi/include/math.h:449:15: error: previous declaration of 'double y1(double)'
    _8x8RGB_V5.ino: In function 'void setup()':
    _8x8RGB_V5.ino:72:18: error: invalid conversion from 'double (*)(double)' to 'byte {aka unsigned char}' [-fpermissive]
    _8x8RGB_V5.ino:13:6: error:   initializing argument 1 of 'void Led(byte, byte, byte, byte)' [-fpermissive]
    _8x8RGB_V5.ino: In function 'void loop()':
    _8x8RGB_V5.ino:103:22: error: invalid conversion from 'double (*)(double)' to 'byte {aka unsigned char}' [-fpermissive]
    _8x8RGB_V5.ino:13:6: error:   initializing argument 4 of 'void Led(byte, byte, byte, byte)' [-fpermissive]
    _8x8RGB_V5.ino:105:22: error: invalid conversion from 'double (*)(double)' to 'byte {aka unsigned char}' [-fpermissive]
    _8x8RGB_V5.ino:13:6: error:   initializing argument 4 of 'void Led(byte, byte, byte, byte)' [-fpermissive]
    _8x8RGB_V5.ino:137:21: error: invalid conversion from 'double (*)(double)' to 'byte {aka unsigned char}' [-fpermissive]
    _8x8RGB_V5.ino:13:6: error:   initializing argument 4 of 'void Led(byte, byte, byte, byte)' [-fpermissive]
    _8x8RGB_V5.ino:139:21: error: invalid conversion from 'double (*)(double)' to 'byte {aka unsigned char}' [-fpermissive]
    _8x8RGB_V5.ino:13:6: error:   initializing argument 4 of 'void Led(byte, byte, byte, byte)' [-fpermissive]
    _8x8RGB_V5.ino:175:19: error: invalid conversion from 'double (*)(double)' to 'byte {aka unsigned char}' [-fpermissive]
    _8x8RGB_V5.ino:13:6: error:   initializing argument 4 of 'void Led(byte, byte, byte, byte)' [-fpermissive]
    _8x8RGB_V5.ino: In function 'void greeper()':
    _8x8RGB_V5.ino:312:30: error: invalid conversion from 'double (*)(double)' to 'byte {aka unsigned char}' [-fpermissive]
    _8x8RGB_V5.ino:233:6: error:   initializing argument 4 of 'void Led(byte, byte, byte, byte)' [-fpermissive]
    _8x8RGB_V5.ino:320:30: error: invalid conversion from 'double (*)(double)' to 'byte {aka unsigned char}' [-fpermissive]
    _8x8RGB_V5.ino:233:6: error:   initializing argument 4 of 'void Led(byte, byte, byte, byte)' [-fpermissive]
    _8x8RGB_V5.ino:326:28: error: invalid conversion from 'double (*)(double)' to 'byte {aka unsigned char}' [-fpermissive]
    _8x8RGB_V5.ino:233:6: error:   initializing argument 4 of 'void Led(byte, byte, byte, byte)' [-fpermissive]
    _8x8RGB_V5.ino:334:28: error: invalid conversion from 'double (*)(double)' to 'byte {aka unsigned char}' [-fpermissive]
    _8x8RGB_V5.ino:233:6: error:   initializing argument 4 of 'void Led(byte, byte, byte, byte)' [-fpermissive]
    
     
  2. DracoLlasa

    DracoLlasa UDOOer

    Joined:
    Oct 15, 2013
    Messages:
    419
    Likes Received:
    3
    Re: error compiling - Udoo vs Win7 / Arduino 1.5.4

    are you using the most recent (v1.2) Linaro image? that fixed a lot of issues with the Arduino IDE
    Also i know the mega and Due are quite different, but while im not an expert, i dont see the use of any code or libraries that could be causing that type of compatibility problem

    Another option i would suggest would be to to connect the UDOO to your Win7 PC as an Arduino DUE, then use the Arduino IDE (with the patch) to upload the sketch. This should determine if the issue with with the UDOO compiling it or with the code/Due
    For more details on this
    See this thread: viewtopic.php?f=6&t=303
    Or this Wiki Page: http://goo.gl/xoa1I6

    Assuming you are on the most recent updated version, and it works from the Windows side, i would have to yield to more experienced people to provide guidance
     
  3. lecktricker

    lecktricker New Member

    Joined:
    Oct 28, 2013
    Messages:
    3
    Likes Received:
    0
    Re: error compiling - Udoo vs Win7 / Arduino 1.5.4

    it´s a Udoo Quad with latest Ubuntuversion 1.2

    Yes there is no use of external library, only the arduinobased function Shiftout() is used. I think to test it with Udoo as external Board make no sense for me, because the first step the compileprocess ( Programming the Arduino embedded from UDOO itself ) fails. And i know the code works fine, there is no Arduino Due specify code. There is no chance to upload the code internal and this need to clarify.

    it looks like:
    according to my current knowledge and google could it be something with compiler, gcc or right management
     
  4. DracoLlasa

    DracoLlasa UDOOer

    Joined:
    Oct 15, 2013
    Messages:
    419
    Likes Received:
    3
    Re: error compiling - Udoo vs Win7 / Arduino 1.5.4

    i think doing it external will prove its the UDOO/Linux side and that the UDOO/Due will take the code properly.. additionally, its a pretty simply processing if you already have 1.5.4 of the IDE, but alas that is your decision.

    I am not very experienced with how it does its compiling but i know many here are, hopefully one of them will jump in and help.
     
  5. lecktricker

    lecktricker New Member

    Joined:
    Oct 28, 2013
    Messages:
    3
    Likes Received:
    0
    Re: error compiling - Udoo vs Win7 / Arduino 1.5.4

    Ok magic is over, I've found the error.
    For some reason you can not use byte declaration byte y0 and byte y1, because it is used somewhere in the Arduino own code and it comes to a double allocation.
     

    Attached Files:

  6. DracoLlasa

    DracoLlasa UDOOer

    Joined:
    Oct 15, 2013
    Messages:
    419
    Likes Received:
    3
    very nice find, and thank you so much for sharing your findings, that is one im going to have to rememeber
     

Share This Page