SoftwareSerial with ATTiny84 using ATtiny library

No problem. I set TinyISP to use SoftwareSerial again. I do get output with your sketch, but it is not legible.
The second problem is - I have a push button and an led. I need to connect both to the attiny without interfering with the other pins used for programming. So far I have tried pin 3 for the led and pin 2 for the button, but this breaks my code - i.e. it behaves weird. If I disconnect all jump wires and attach the led to pin 1 and the button to pin 0, it works - but I obviously don't get any output.
I am doing all this because I want to save a value to the tiny's EEPROM and I am using the button to enter a "settings mode". Then I am using the led as a visual feedback for the user so he knows which value has been saved. Upon reset I want to load the value from EEPROM and blink the led n-times according to the saved value. This fails and I don't know why.
This was my initial reason to search for a way to print the debug output from the tiny to check the EEPROM value.

Just a little follow-up. I was able to get output with KnockBang. I have attached the led to attiny's pin 3 and the button to pin 0. This does not interfere with the programming via Arduino Uno.
And writing and reading from EEPROM works too :slight_smile: I needed to convert values with int() and byte().

Hello,
I think it is a bit off topic, but I found no better post for this topic.

I wanted to use the famous TinyISP programm to allow serial debug output of an ATtinyx5 into the Arduino IDE Serial Monitor.

Unfortunately the ATtinyx5 pin number in file TinyDebugSerial.h was not set to fit the standard ArduinoISP setup.
I had to change the pin number from 3 to 1, then it worked (CPU clock 1 MHz).

I have documented all that on my web page: http://www.rudiswiki.de/wiki9/AVRTinyISP

Regards to Coding Badly for the good software. :slight_smile:
Rudolf

Hello,

rudolf48:
I wanted to use the famous TinyISP programm...

Famous?

I have documented all that on my web page: http://www.rudiswiki.de/wiki9/AVRTinyISP

Thank you for taking the time to write about your experience and posting a link here.

Regards to Coding Badly for the good software. :slight_smile:

My pleasure. I'm glad you find it useful.

Have (had) you considered using Knock-Bang instead of Serial? I use it with an ATtiny13 processor so the footprint has to be even smaller than TinyDebugSerial. (There are a few other benefits over Serial.)

Hello Coding Badly,

No, I have not tried the Knock-Bang protocol, because I thought it needs more flash-ROM space than the serial protocol.
When you say so that it needs less space, I will give it a try.

Regards, Rudolf

Knock-Bang uses roughly half the space of TinyDebugSerial. println of an integer is 292 bytes versus 582 bytes. println of a Flash string constant is 282 versus 638. One println of each is 348 versus 710.

I use it with an ATtiny13

I did not know your Tiny core supported the attiny13 ?

I have used smeezekitty's tiny13 core, which is great, but it would be nice to be able to use your TinyISP.

Erni:
I did not know your Tiny core supported the attiny13 ?

The version on my desk (mostly) does. It has some goodies that actually make the ATtiny13 useful. But the core is not complete (no: analogRead, delay, delayMicroseconds, tone w/ variable parameters).

I have used smeezekitty's tiny13 core, which is great, but it would be nice to be able to use your TinyISP.

Knock-Bang should be independent of the core. TinyISP + Knock-Bang should work well with smeezekitty's core (or any other core).

Hello Coding Badly,

I tried the KnockBang protocol, but I got the error message from the compiler :
warning: TinyDebugKnockBang.h: No such file or directory

I had copied before both files to the "library" folder.
Also copying them to the "hardware/cores/tiny" folder did not help.

Regards, Rudolf

Hello rudolf48,

rudolf48:
I tried the KnockBang protocol, but I got the error message from the compiler :
warning: TinyDebugKnockBang.h: No such file or directory

You put the files in the wrong location.

Also copying them to the "hardware/cores/tiny" folder did not help.

Don't put them there.

I had copied before both files to the "library" folder.

"library" or "libraries"? Under a folder named "TinyDebugKnockBang"?

The correct location is...

{Arduino Sketch Root}\libraries\TinyDebugKnockBang\

Hello Coding Badly,

Thank you for the hint with the library path. That was my fault.
Because I forget so quickly, I documented that KnockBang setup in my wiki.
http://www.rudiswiki.de/wiki9/AVRTinyISP#KnockBang_serial_protocol

Please take a time to read the details, if I have all necessary documented.

Regards, Rudolf

Hello rudolf48,

This...

The application program must have the following statements for debug output, for example:

# declaration

#include <TinyDebugSerial.h>
TinyDebugSerial mySerial = TinyDebugSerial(); // PB1 = TX pin

in function setup()

mySerial.begin( 9600 );    // for tiny_debug_serial

in function loop()

mySerial.println( "Testing...");  // debug output

...is not necessary. The Tiny Core already includes an instance of TinyDebugSerial named Serial. This should work...

# in function setup()
  Serial.begin( 9600 );    // for tiny_debug_serial 

# in function loop()
  Serial.println( "Testing...");  // debug output

I think the Knock-Bang example can be reduced to this...

#define KNOCK_BANG 1
#include <TinyDebugKnockBang.h>

#ifdef KNOCK_BANG
#define Serial Debug
#endif

..then you just use Serial...

// the setup routine runs once when you press reset:
void setup() {                
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);  
  Serial.begin( 9600 );
}

// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(1000); 
  Serial.println( "Testing...");  // debug output
}

Hello Coding Badly,

Thank you very much for improving my example C-code. Probably I will never reach this level :frowning:
http://www.rudiswiki.de/wiki9/AVRTinyISP#KnockBang_serial_protocol

I am answering so late, because I struggled a day finding a loose contact on my breadboard :frowning:

But now I have a compact and clever debugging tool for the ATtiny's.

Best regards, Rudolf

Very nice. Thank you for the follow-up.

Nice write-up rudolf.

My thoughts about Serial Relay and Knockbang.

I think the buty about Serial Relay is that you have two way communication. This makes the tiny environment look and feel almost like an Arduino.

If you want to utilize this feature you have to use SoftwareSerial, atleast that is my understanding.
On the other hand I can see the advantage of using the TinyDebugSerial: You can take a Arduino sketch an compile it for a tiny without midifying the Serial.print() statements.

Just a follow up on a previous post:

I have tried using KnockBang on a Attiny13, with no luck

I get this error:

In file included from tiny_knockbang.cpp:1:
D:\arduino-1.01\arduino-1.0.1-windows (1)\arduino-1.0.1\libraries\TinyDebugKnockBang/TinyDebugKnockBang.h:55: error: 'fstr_t' does not name a type

Delete that line (#55) from TinyDebugKnockBang.h ...

After deleting line 55, I get this error:

D:\arduino-1.01\arduino-1.0.1-windows (1)\arduino-1.0.1\libraries\TinyDebugKnockBang/TinyDebugKnockBang.h:152: error: expected ',' or '...' before '*' token

Which core are you using?