Digistump Forums
The Digispark => Digispark (Original) Support => Topic started by: r4v5 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
-
r4v5 - I apologize - we hadn\'t intended for that code to go out yet, we\'ll have it fixed up shortly.
-
No rush; I was just wondering if my install was broken. The digisparkUSB sketch has a handful of warns and errors in it too.
-
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
-
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.)
-
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
-
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
-
@dmcinnes - I think the issue is that you need to set the Board to Digispark Tiny Core
-
@digistump that did it, thanks!
-
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.
-
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))
-
@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.
-
@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
-
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).
-
Checkout the latest update for plenty of examples of how to talk to DigiBlink
-
software update that is