Author Topic: RGB Example Sketch not compiling  (Read 9817 times)

r4v5

  • Newbie
  • *
  • Posts: 5
RGB Example Sketch not compiling
« on: December 19, 2012, 07:07:03 pm »
Hi,

I got my board(s) and shield(s) in the mail today, soldered 'em up, and downloaded the latest version of the supplied build of Arduino for OSX.

I was able to successfully program the board using the Start sketch, and figured I'd try to use the DigisparkRGB sketch too but compilation fails with the following error:

core.a(wiring.c.o): In function `__vector_5':
/Users/r4v5/Downloads/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/wiring.c:49: multiple definition of `__vector_5'
DigisparkRGB/DigisparkRGB.cpp.o:/Users/r4v5/Downloads/Arduino.app/Contents/Resources/Java/libraries/DigisparkRGB/DigisparkRGB.cpp:59: first defined here
« Last Edit: December 19, 2012, 07:07:03 pm by r4v5 »

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
RGB Example Sketch not compiling
« Reply #1 on: December 19, 2012, 07:14:02 pm »
r4v5 - I apologize - we hadn\'t intended for that code to go out yet, we\'ll have it fixed up shortly.

r4v5

  • Newbie
  • *
  • Posts: 5
RGB Example Sketch not compiling
« Reply #2 on: December 19, 2012, 07:20:35 pm »
No rush; I was just wondering if my install was broken. The digisparkUSB sketch has a handful of warns and errors in it too.

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
RGB Example Sketch not compiling
« Reply #3 on: December 20, 2012, 11:39:43 am »
Both of these are fixed in the newest release (Dec 20) - we\'ll have some supporting software for the DigiBlink shortly as well as a tutorial on how to use the USB library

r4v5

  • Newbie
  • *
  • Posts: 5
RGB Example Sketch not compiling
« Reply #4 on: December 20, 2012, 01:04:37 pm »
Interestingly, DigiBlink identifies as an HID instead of a serial port when programmed. Is that intentional? I know very little about the nitty gritty of USB.

(I\'m impatient and was trying to figure out how to poke it into doing things.)

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
RGB Example Sketch not compiling
« Reply #5 on: December 20, 2012, 01:25:55 pm »
Yes, emulating serial is far less reliable then being a hid device, so we communicate as a hid device (also simpler in terms of driver requirements)


Here is some python that will make that code work - we\'ll be making a full tutorial on it as soon as we have a chance and releasing some binaries for osx and win as well.

usage of this is nameofscript.py name_of_color

so if the script is called digiblink.py

digiblink.py red

will turn the led red


#/usr/bin/python

import usb # 1.0 not 0.4


import sys
sys.path.append(\"..\")

from arduino.usbdevice import ArduinoUsbDevice


if __name__ == \"__main__\":

    theDevice = ArduinoUsbDevice(idVendor=0x16c0, idProduct=0x05df)

    print \"Found: 0x%04x 0x%04x %s %s\" % (theDevice.idVendor,
                                          theDevice.idProduct,
                                          theDevice.productName,
                                          theDevice.manufacturer)




    import sys
    import time
    import webcolors


    #sequence = [11,12,13]* 20
    #random.shuffle(sequence)

    #print \"Look over there, flashing lights!\"

    if len(sys.argv)<3:

        color_list = webcolors.name_to_rgb(sys.argv[1].lower())
        color_list = list(color_list)
        color_list.insert(0, 0)
    else:
        color_list = sys.argv




   # while 1:
        #pin = int(pin)



        #if output == \"\\r\":
        #    print line
        #    line =\"\"
        #else:
        #    line += output
        #else:
   
        #    print \"Pin response didn\'t match.\"

    #byte val = sys.argv[1]
    print color_list

    theDevice.write(ord(\"s\"))

    if color_list[1] == 0:
        theDevice.write(0)
    else:
        theDevice.write(int(color_list[1]))

    if color_list[2] == 0:
        theDevice.write(0)
    else:
        theDevice.write(int(color_list[2]))

    if color_list[3] == 0:
        theDevice.write(0)
    else:
        theDevice.write(int(color_list[3]))

    #theDevice.write(ord(\"e\"))
        #time.sleep(2)

    #print
   
                               


dmcinnes

  • Newbie
  • *
  • Posts: 21
RGB Example Sketch not compiling
« Reply #6 on: December 31, 2012, 10:08:22 am »
Hi, I\'m also having problems compiling the RGB sketch on OS X. I was using the Dec 20th version and I just updated to the latest -- Dec 30th version -- but I\'m still having the same problem.

Here\'s the output:

core.a(wiring.c.o): In function `__vector_5\':
/Applications/Digispark Ready - Arduino 1.03.app/Contents/Resources/Java/hardware/arduino/cores/arduino/wiring.c:49: multiple definition of `__vector_5\'
DigisparkRGB/DigisparkRGB.cpp.o:/Applications/Digispark Ready - Arduino 1.03.app/Contents/Resources/Java/libraries/DigisparkRGB/DigisparkRGB.cpp:59: first defined here

Thanks,
Doug

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
RGB Example Sketch not compiling
« Reply #7 on: December 31, 2012, 10:39:23 am »
@dmcinnes - I think the issue is that you need to set the Board to Digispark Tiny Core

dmcinnes

  • Newbie
  • *
  • Posts: 21
RGB Example Sketch not compiling
« Reply #8 on: December 31, 2012, 10:43:48 am »
@digistump that did it, thanks!

maudette01432

  • Newbie
  • *
  • Posts: 16
RGB Example Sketch not compiling
« Reply #9 on: January 01, 2013, 11:42:20 am »
Could you please put some information into the header of the DigisparkRGB noting that the board needs to be set to \"Digispark (Tiny Core)\".  This isn\'t particularly clear since the \"getting started\" example can use either and the \"MIT\" board is the first one listed in the list.  The description of the two boards is a little lackluster still but I\'m sure it will get polished up.  Thankfully the forum here is searchable and it only took me a couple seconds to come across this answer.

probono

  • Newbie
  • *
  • Posts: 17
RGB Example Sketch not compiling
« Reply #10 on: January 01, 2013, 02:10:49 pm »
Here\'s my iteration:

#!/usr/bin/python

#
# Set Arduino IDE to use \"Digispark (Tiny Core)\",
# load DigiBlink.ino sketch onto the Digispark, connect
# Pin 0 (=ATtiny 5th pin) -> red RGB LED anode
# Pin 1 (=ATtiny 6th pin) -> green RGB LED anode
# Pin 2 (=ATtiny 7th pin) -> blue RGB LED anode
# and the RGB LED cathode via a suitable resistor to GND
# then run this script with a web color name, e.g.,
# sudo ./DigiRGB.py yellow
# or with some RGB color, e.g.,
# sudo ./DigiRGB.py 0 0 255
#

import sys, time
import usb # PyUSB 1.0, to be bundled
import webcolors # to be bundled
from arduino.usbdevice import ArduinoUsbDevice # to be bundled

if __name__ == \"__main__\":
    theDevice = ArduinoUsbDevice(idVendor=0x16c0, idProduct=0x05df)
    print \"Found: 0x%04x 0x%04x %s %s\" % (theDevice.idVendor,
                                          theDevice.idProduct,
                                          theDevice.productName,
                                          theDevice.manufacturer)

    if len(sys.argv)==1:
        color_list = [255,255,255]
    elif (len(sys.argv)>1 and len(sys.argv)<3):
        color_list = webcolors.name_to_rgb(sys.argv[1].lower())
        color_list = list(color_list)
    else:
        color_list = sys.argv[1:4]

    print(\"Send initialization to USB\")
    theDevice.write(ord(\"s\"))

    print(\"Send colors to USB\")
    for color in color_list:
        if color == 0:
            theDevice.write(0)
        else:
            theDevice.write(int(color))
« Last Edit: January 01, 2013, 02:11:27 pm by probono »

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
RGB Example Sketch not compiling
« Reply #11 on: January 01, 2013, 07:23:33 pm »
@maudette01432 and everyone else - the next release will not have the MIT board option, as I see no advantage to it over the Tiny core at this point - that should clear up confusion.

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
RGB Example Sketch not compiling
« Reply #12 on: January 01, 2013, 07:24:18 pm »
@probono - thanks, my python is weak at best, but I thought python was a good language to kick things off in since it is widely supported and known

r4v5

  • Newbie
  • *
  • Posts: 5
RGB Example Sketch not compiling
« Reply #13 on: January 03, 2013, 09:20:04 am »
Just dropping a note that the python code here does successfully talk to the DigiBlink and behaves properly on OSX (with my own installations of webcolors and pyusb).

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
RGB Example Sketch not compiling
« Reply #14 on: January 05, 2013, 12:54:57 am »
Checkout the latest update for plenty of examples of how to talk to DigiBlink