The script compiles and shows no problems after uploading to the ATTiny.
The LED starts blinking correctly, but after a certain time starts blinking in a constant frequency.
im NOT a very experienced C programmer or nothing. But i recently checked that "library" you mentioned. It seems this "library" is a pretty bad example of how a library should not be. Since its broken and needs a lot of fixing first before it can be used properly.
it seems not to be working "out of the box" with Arduino IDE 1.01. Seems youll need to add
to it to have it compile properly in the latest IDE.
it seems it does not support the arduinos "tone()" function. As far i can tell it requires an "pwm" Pin to put out any "audio" or beeping using the default 500hz PWM at 50% duty cycle. pretty ugly if you ask me.
The "Usage" documentation that is included in the source code is outdated and does not include the complete parameter requirements.
the sendmsg() function seemed to require a pointer (?) or memory adress where it can find the string. So im not sure it can just take in a "string" like in your demo.
To me this does not look like a good choice for a morse library. At least none that is supposed to work out of the box.
instead of a ( ._) it sends b (- . . ) that can be corected by change this line
_i = ((byte) c) - 33;
to this:
_i = ((byte) c) - 34;
But then again it sends different morsecode for d and D ... and so on
Maybe the problems you see is a memory issue, I just tried it on a UNO it kept on running for atleast 10 minutes
I haven't figured out why it is going wrong yet but it doesn't handle lower case letters correctly.
I have a workaround. Change this line at the end of Morse.cpp:
send(*str++);
to this:
send(toupper(*str++));
which forces it to deal only with upper case.
If you do this, you can remove all the lower case letters from the _morsetab table because it will never use them and it'll save a bit of SRAM.
yes, i did some more experimenting too and patched that so called "library" too. also figgured that lowercase problem lately since it works with numbers and if called with a decimal value instead of a "charakter".
that toupper(*str++) patch looks nice in simple! i love it.
ill add that to my version and re-submit it to the developer.
but even we now managed it to work, to me this "library" is a shame. a user, especialy an arduino user is not supposed to "fix a library first" before first use.
thats up to hackers, coders and admins
in my version i replaced the requirement of a PWM Pin for speaker output with the tone() function. is already send to the author.
hopefully he will add all the stuff we commited soon.
Aaaarrrgghhhhhhhhhhhh.
Found it.
My previous fix isn't required unless you want to save some SRAM but the problem was this line in _morsetab:
1, //ASCII 92 \
The backslash at the end of the line is treated as a line continuation, so the comment is continued to include (and therefore remove) the next line. This has the effect of removing one element from the table and so 'a' will be indexed into 'b', 'b' into 'c' etc.
I've made one change to the code. Instead of putting "toupper" in sendmsg, I have put it in send() so it will work whether you send a string or a single character. I've also removed the lower case chars from the table.
I've attached a zip of morse.cpp and morse.h with my fixes.
I downloaded the corrected files from Axel Werner and played arround getting the beeper work. When uploading the script to the arduino everything works fine (beeping) but when upoading the sketch to the ATtiny85 I get the errormessage:
Expected signature for ATtiny85 is 1E 93 0B
Double check chip, or use -F to override this
I am not sure what went wrong there, but I can confirm that the files el_supremo suplied, works fine on my attiny85.
BTW it has morsed more than half an hour now
im no expert. but to me this sounds like a problem with the programmer tool itself. something like the programmer would expect a different chip to programm, say an arduino micro and found something different, to it blocks n warns.
have you tried to switch the "board type" or cpu type in your programmers app to a matching one?