Digistump Forums
The Digispark => Digispark (Original) Support => Topic started by: albercook on April 14, 2013, 02:39:15 pm
-
Don't get me wrong. I'm not complaining but I am tired and a bit frustrated.
I have been reading the forum, the wiki and readme.txt files for three hours. I understand that the serial monitor like functions on the digispark are in the development stages and still need work. I also have three sensors connected to my digispark and writing if-then loops to turn on an LED when the value is greater than or less than a constant is a very slow why to debug.
I have looked at the ruby gem code. I have downloaded it and I have installed Python. It does not work either. There are too many variables. It has taken me hours just to find all the little parts and I'm full of questions.
What is the difference between send.exe/receive.exe and read.exe/write.exe for example?
How are DigiUSB and Digiscope.exe related?
When BlueBie says "DigiUSB also comes with a little terminal called digiterm" What does that mean? Where is digiterm? Is it run from within the Arduino environment?
I need a screen shot. I don't even know where to expect information from my digispark to show up? Do I need to be running another terminal program?
If you all will help me get clear on a step by step set of instructions on how to implement some sort of debuging I will help write it up for the wiki.
First question?
There seems to be three options the ruby gem from Bluebie, the C++ code and the Python code. Can someone help me understand the pros and cons of these three options? Then let's write clear step-by-step instructions of getting the best option for a noob like me.
Thank you for listening.
-
You could add the keyboard library to your sketch and use DigiKeyboard.println where you would normally use serial.print.
Then you can open a notepad and make sure its selected after you upload the sketch. That's what I do for figuring out usable sensor values.
-
The rubygem is a package installable using the rubygem package manager (you wont get any benefit from just downloading the files from github, unless you also use the gem tools to compile it in to a gem and install it.
To install the rubygem, make sure you have libusb 1.x and ruby 1.9.x or ruby 2.0 installed (mac's and many versions of linux come with 1.8 installed, which is no good for this), then open a terminal and run 'gem install digiusb'. You might need to sudo that depending on your platform. Finally, you aught to be able to just type 'digiterm' in your terminal window and it will find the most recently attached digispark, connect to it, and start outputting everything printed via DigiUSB on the device and forwarding keystrokes from the terminal window in to the digispark.
Because of all this complex interdependency, although in my view the digiterm is still the nicest digiusb monitor app, it's not a good option for beginners. I don't know much about the other alternatives. DigiKeyboard is certainly a great option because you don't need to install any special stuff. All of these are however kind of crummy, because the USB libraries require constant attention. DigiUSB is the most relaxed of the bunch (at least when using the rubygem), only requiring you refresh it once per second at minimum. Still, if you have long running loops digiusb is not a good option.
Digispark is able to be cheap because it eliminates the dedicated usb serial converter chip present on most arduinos, but that trade off is not without it's price. Still I fully expect print debugging to improve in the future. It is already so much better thanks to DigiKeyboard.print() being added.
-
Digikeyboard is great option fo things like sensor values.
The Rubygem is great if it works for you.
As far as DigiUSB tools packaged with the software I think the DigiUSB library (see the Echo example for how to print a message back to the computer) in conjunction with the digiusb.exe program in the DigiUSB Programs folder is the simplest option - use the library in your sketch, print out the data you want to see on the computer (like using Serial with the Arduino) and open digiusb.exe once you're device is plugged in - it then should display similar to the Arduino serial monitor, showing messages as they come in and allowing you to send data to the device (if you've set your sketch up to receive it). If you give that a try and have more questions let me know and I'll be sure to answer them tomorrow.
-
Thanks for the reply. When I try to run digiusb.exe I get an error that says I'm missing pdcurses.dll and that I should uninstall and reinstall the program and reboot. I did that but still get the error.
-
I did a search on the internet and found the following instructions
Go http://sourceforge.net/projects/pdcurses/files/pdcurses/ (http://sourceforge.net/projects/pdcurses/files/pdcurses/) , download the zip file, and put the dll in the same directory as ghost++ or in the C:\WINDOWS\system32 directory.
I put it in C:\WINDOWS\system32. Now I don't get the error but the only thing that happens is a window pops up and immediately disappears.
-
There are half a dozen pdcurses libraries floating around the net.
The "official" version is far too new for digiusb. I have not been able to find one that workds.
Your disappearing screen is a symptom of a library that has the calls, but they are deprecated.
Another symptom is getting yet another .dll missing error popup.
Digispark, can you tell us what environment you used to build digiusb.exe? I'd be happy to
get one built that has fewer external dependencies. I can't imagine why curses is needed,
probably just because it was in the original term emulator you started from.
Also, there is a usb monitor from the teensy project that is very good. If I knew just a bit more
about how you are emulating the HID, I might be able to get the digispark to be recognized by that.
Cheers!
-sam
-
Wow I didn't realize I hadn't included that/static linked it - I apologize for that.
I've attached the pdcurses file used - please try this on and I'll do a new build with static linking.
-
OK, This pdcurses.dll works.
Note: It is very likely that some of the earlier reported "failures" (including mine) were the result of not having run Digiusb.start()
The DigiUSB and related apps don't wait around for the digispark to be inserted. If it's not there, they exit. The reason is only discovered if the app is run from the command line. If no DigiUSB device is present, "No Digispark Found" is produced on stdout. Of course no one sees the error, as the app is not designed to be run from the command line. In fact, if the app is run from the command line with a DigiUSB present, it fails with a message to the effect that I/O redirection is not permitted. That's the clue that it's only meant to be run from the Windows GUI. I'd reckon only UNIX heads like me ever think to run from the command line.
The only reason I'm using Windows is that I don't have a Linux desktop, they're all servers!
Fix: Change the error reporting to use the win32 api window error message.
Cheers!
-
SamCN2 -
Glad that one works.
The reason I didn't use the win32 api is that this is cross compiled code. If you run from the command line and get the i/o redirection error then you either have a copy running or need to run from an administrator command line I believe. These certainly don't depend on the windows GUI.
I suppose it might be worth it to have it display the error without exiting - so it can actually be seen if someone just double clicks.
-
Not sure if I did this right or not.
I downloaded the new dll and put it in
C:\WINDOWS\system32
I then downloaded Echo from the examples
plugged in my digispark
once download was finished I went to the DigiUSB Progarms folder and doubled clicked digiusb.exe
At this point I got the window that blinked open and immediately disappeared.
-
I tried the example program Keyboard and it prints "Hello Digispark!" in the middle of the program.
It seemed to print wherever the cursor was so I opened a Notepad window and moved the cursor into that window after I started the download.
I will put this as step by step instructions in the wiki. http://digistump.com/wiki/digispark/tutorials/debugging (http://digistump.com/wiki/digispark/tutorials/debugging). Let me know if it is unclear.
Thanks for all your help
-
albercook - run digiusb from a command line - likely it can't find your Digispark but you don't see that message because it flashes up and then closes - you'll be able to see it from the command prompt
If that is the case it might be an issue with permissions (run it as administrator) or your code - are you using the echo demo to test?
-
Thanks for the continuing to reply to my many questions. I did get DigiKeyboard.println to work.
With Echo running I ran digiusb from the command line I got the error "No Digispark Found."
I'm running as admin.
Not sure what the difference is between the way the DigiSpark Programmer and the digiusb.exe look for the digispark.
I added a tutorial on how to use DigiKeyboard.println. Are there features of digiusb that make it preferable to DigiKeyboard?
Thanks again for any help.
-
DigiUSB is a bit less annoying because it wont accidentally type in random jibberish in your arduino program window and stuff things up in that way. It's also bidirectional so you can use it to send bytes to the digispark as well as doing debugging printing stuff. It can also run in the background, so you can have a window open with digiusb running in the background while you do other stuff with the regular keyboard on your computer. For example my household doorbell receives radio signals, converts them in to unique integers, then sends those over digiusb in to a raspberry pi, which triggers off certain codes to run home automation events like send out doorbell press notifications to all the residents computers, on to the TV, everywhere.
Overall I feel DigiUSB is the better option if you can get it working on your computer, but DigiKeyboard is nice and easy and I went to the trouble of adding print and println support to it recently so people could use it for debugging like this without needing to fuss about with finding and setting up digiusb terminal apps. :)
-
Hi,
For those who still have a serial port (native, or through a RS232/USB adapter), I propose an alternative to DigiUSB.
The idea is to send/receive debug/info messages to/from a PC through a regular RS232 serial port but using a single I/O of the Digispark. The external interface is composed of 2 resistors and a regular diode (See link below). This approach allows to use the built-in Serial Monitor of the arduino IDE.
Thanks to the help of the last modifications of the <SoftSerial> and <TinyPinChange> libraries, it's now possible to declare a SoftSerial object with the same pin for Tx and Rx: two additional methods allow to switch from rxMode to txMode.
I wrote a summary at the bottom of: http://digistump.com/wiki/digispark/tutorials/debugging (http://digistump.com/wiki/digispark/tutorials/debugging)
Please, find here the <SoftSerial> and <TinyPinChange> updated libraries (which are already in the Digispark IDE) to benefit of the debugging capabilities:
http://p.loussouarn.free.fr/partage/arduino/Libs4Digi_1io_Debug.zip (http://p.loussouarn.free.fr/partage/arduino/Libs4Digi_1io_Debug.zip)
Just replace existing DigisparkTinyPinChange and DigisparkSoftSerial directories with new ones in DigisparkArduino-Linux32/Digispark-Arduino-1.0.4/libraries directory.
You will find usefull examples in each library after restarting your IDE.
This alternative is mainly recommanded if you didn't plan to use DIgiUSB in your final sketch, or if you haven't enough pins.
@ albercook: hope, this will help...
RC Navy
-
Not sure if I did this right or not.
I downloaded the new dll and put it in
C:\WINDOWS\system32
I then downloaded Echo from the examples
plugged in my digispark
once download was finished I went to the DigiUSB Progarms folder and doubled clicked digiusb.exe
At this point I got the window that blinked open and immediately disappeared.
Hey man sorry for my english but I've found a solution... I had your same problem til 5 minutes ago, so I had an idea: put "pdcurses.dll" in the same folder of digiusb.exe and try again. Now it works! See the screenshot
Hope it works with you too
-
This is already done for you on the newest version of our software as well.