This is an old revision of the document!
The DigiSpark is small and inexpensive. To keep it that way it has limited features. One feature that Arduino programmers may miss is the serial monitor window. On the Arduino this is used to send and receive information from the Arduino.
Although the DigiSpark does not support the serial monitor window there are several options available with similar features.
Also see the DigiKeyboard Wiki Page
There is also a RubyGem for communication using the DigiUSB Library
The rubygem is a package install-able using the rubygem package manager. You can download the files from github but you also need to use 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 inter-dependency it might not be a good option for beginners.
The onboard LED and the I2C LCD can also be good debugging options.
Since the last version of <SoftSerial> library (may 2013), <SoftSerial> is an alternative for debugging Digispark just using a single I/O. By declaring a <SoftSerial> object with the same pin for Tx and Rx: it's possible to use a half duplex (request/response) software serial port using a single I/O.
Usage:
In your sketch, declare a <SoftSerial> object with the same pin for Tx and Rx as depicted below:
/* Hardware wiring: =============== SERIAL ONE WIRE DEBUGGING CABLE ___________________/\__________________ / \ ____ .--------. | \ | GND |--------------------------------+---o5 \ | | 47K | | 9o | | | .--###--' | o4 | | DEBUG | 4.7K | | 8o | | TX_RX |-------------------###--+--|<|------o3 | ---> To regular RS232 SubD 9 pins Male of PC or Serial/USB adapter | PIN | ^ | 1N4148 | 7o | | | | '-----------o2 | '--------' | | 6o | ATtiny85 Single | o1 / (Digispark) I/O |____/ SubD 9 pins Female */ #include <TinyPinChange.h> #include <SoftSerial.h> #define DEBUG_TX_RX_PIN 2 //Adjust here your Tx/Rx debug pin SoftSerial MyDbgSerial(DEBUG_TX_RX_PIN, DEBUG_TX_RX_PIN, true); //true allows to connect to a regular RS232 without RS232 line driver void setup() { MyDbgSerial.begin(38400); //After MyDbgSerial.begin(), the serial port is in rxMode by default MyDbgSerial.txMode(); //Before sending a message, switch to txMode MyDbgSerial.println(F("\nDebug enabled")); MyDbgSerial.rxMode(); //switch to rxMode to be ready to receive some commands } void loop() { if(MyDbgSerial.available()) { MyDbgSerial.txMode(); MyDbgSerial.print(F("Received: ");MyDbgSerial.write(MyDbgSerial.read());MyDbgSerial.print(F("\n"); MyDbgSerial.rxMode(); } }
If you didn't plan to use DigiUSB in your sketch, this alternative consumes less pin than USB and less program memory. Plug the “Serial One Wire Debugging Cable ” to a native RS232 port or a RS232/USB adapter to your development PC. On the PC, open your favorite Terminal application at 38400,n,8,1: HyperTerminal, Teraterm (Windows) or Minicom, GtkTerm (Linux) and CoolTerm for MAC does the trick.
Trick to be less intrusive: use a “high” data rate (38400 is fine): less time wasted in ISR and for transmitting each character.
“Vintage” serial interfaces are not dead!