OK, I have been using the ATtiny85 for a lot of Halloween Projects but I have a couple of sketches that have 6 to 11 outputs which the ATtiny84 has. My question is, other then the different pin numbers and selecting the proper chip info, is the 84 programming the same and uses the same 6 connections as the 85? Last thing I want to do is see smoke coming from the Arduino board!
Dave
cougar69:
My question is, other then the different pin numbers and selecting the proper chip info, is the 84 programming the same...
Yes.
...and uses the same 6 connections as the 85?
No... http://zygomorphic.com/arduino-tiny/?page_id=7 ...click Show Connections for 14-pin Processors.
Thank You !!!! Still learning so thanks for the support!
Dave
Been programming some Halloween sketches with no problems and decided to do a sketch for an RC plane. Well my luck ran out! I am getting this error message. Any suggestions?
c:/documents and settings/david & melody/desktop/arduino-1.0.3/hardware/tools/avr/bin/…/libgcc/avr/4.3.2/…/…/…/…/avr/lib/avr25/crttn84.o:(.init9+0x2): relocation truncated to fit: R_AVR_13_PCREL against symbol ‘exit’ defined in .fini9 section in c:/documents and settings/david &melody/desktop/arduino uno/arduino-1.0.3/hardware/tools.avr/bin/…/lib/gcc/avr/4.3.2/avr25\libgcc.a(_exit.o)
const int topled=0;
const int bottomled=1;
const int leftwingtip=2;
const int rightwingtip=3;
const int revolving1=6;
const int revolving2=7;
const int tailled=4;
unsigned long previoustop=0;
unsigned long previousbottom=0;
unsigned long revolving1time=0;
unsigned long revolving2time=0;
int topoff=1000;
int topon=30;
int bottomoff=1100;
int bottomon=100;
int wingLongOff=100;
int wingOn=40;
int wingOff=100;
int revolving1periode=2000;
int value;
int Fade1Off=2;
int Fade1On=2000;
int revolving2periode=1250;
int Fade2Off=2;
int Fade2On=1250;
unsigned long wingStartMillis=0;
unsigned long fade1StartMillis=0;
unsigned long fade2StartMillis=0;
enum ledState {
firstOnPeriod, short1Interval, secondOnPeriod, short2Interval, thirdOnPeriod, short3Interval, fourthOnPeriod, short4Interval, fifthOnPeriod, short5Interval, sixthOnPeriod, short6Interval, seventhOnPeriod, short7Interval, eighthOnPeriod, short8Interval, ninthOnPeriod, short9Interval, tenthOnPeriod, short10Interval, elenventhOnPeriod, longInterval};
static ledState wingState=longInterval;
enum revolving1State {
Fade1, Off };
static revolving1State revolve1State=Off;
enum revolving2State {
Fade2, Off2 };
static revolving2State revolve2State=Off2;
void setup(){
pinMode(topled, OUTPUT);
pinMode(bottomled, OUTPUT);
pinMode(leftwingtip, OUTPUT);
pinMode(rightwingtip, OUTPUT);
pinMode(tailled, OUTPUT);
}
void loop(){
unsigned long currenttop=millis();
unsigned long currentbottom=millis();
if(currenttop-previoustop>=topon){
digitalWrite(topled, LOW);
}
if(currenttop-previoustop>=topoff){
previoustop=currenttop;
digitalWrite(topled, HIGH);
}
if(currentbottom-previousbottom>=bottomon){
digitalWrite(bottomled, LOW);
}
if(currentbottom-previousbottom>=bottomoff){
previousbottom=currentbottom;
digitalWrite(bottomled, HIGH);
}
unsigned long now=millis();
switch (wingState){
case firstOnPeriod:
if(now-wingStartMillis>=wingOn){
wingState=short1Interval;
}
break;
case short1Interval:
if(now-wingStartMillis>=wingOn+wingOff){
digitalWrite(leftwingtip,HIGH);
wingState=secondOnPeriod;
}
break;
case secondOnPeriod:
if(now-wingStartMillis>=wingOn+wingOff+wingOn){
digitalWrite(leftwingtip,LOW);
wingState=short2Interval;
}
break;
case short2Interval:
if(now-wingStartMillis>=wingOn+wingOff+wingOn+wingOff){
digitalWrite(leftwingtip,HIGH);
wingState=thirdOnPeriod;
}
break;
case thirdOnPeriod:
if(now-wingStartMillis>=wingOn+wingOff+wingOn+wingOff+wingOn){
digitalWrite(leftwingtip,LOW);
wingState=short3Interval;
}
break;
case short3Interval:
if(now-wingStartMillis>=wingOn+wingOff+wingOn+wingOff+wingOn+wingOff){
digitalWrite(tailled,HIGH);
wingState=fourthOnPeriod;
}
break;
case fourthOnPeriod:
if(now-wingStartMillis>=wingOn+wingOff+wingOn+wingOff+wingOn+wingOff+wingOn){
digitalWrite(tailled,LOW);
wingState=short4Interval;
}
break;
case short4Interval:
if(now-wingStartMillis>=wingOn+wingOff+wingOn+wingOff+wingOn+wingOff+wingOn+wingOff){
digitalWrite(tailled,HIGH);
wingState=fifthOnPeriod;
}
break;
case fifthOnPeriod:
if(now-wingStartMillis>=wingOn+wingOff+wingOn+wingOff+wingOn+wingOff+wingOn+wingOff+wingOn){
digitalWrite(tailled,LOW);
wingState=short6Interval;
}
break;
case short6Interval:
if(now-wingStartMillis>=wingOn+wingOff+wingOn+wingOff+wingOn+wingOff+wingOn+wingOff+wingOn+wingOff){
digitalWrite(rightwingtip,HIGH);
wingState=seventhOnPeriod;
}
break;
case seventhOnPeriod:
if(now-wingStartMillis>=wingOn+wingOff+wingOn+wingOff+wingOn+wingOff+wingOn+wingOff+wingOn+wingOff+wingOn){
digitalWrite(rightwingtip,LOW);
wingState=short7Interval;
break;
}
case short7Interval:
if(now-wingStartMillis>=wingOn+wingOff+wingOn+wingOff+wingOn+wingOff+wingOn+wingOff+wingOn+wingOff+wingOn+wingOff){
digitalWrite(rightwingtip,HIGH);
wingState=eighthOnPeriod;
}
break;
case eighthOnPeriod:
if(now-wingStartMillis>=wingOn+wingOff+wingOn+wingOff+wingOn+wingOff+wingOn+wingOff+wingOn+wingOff+wingOn+wingOff+wingOn){
digitalWrite(rightwingtip,LOW);
wingState=short8Interval;
break;
}
case short8Interval:
if(now-wingStartMillis>=wingOn+wingOff+wingOn+wingOff+wingOn+wingOff+wingOn+wingOff+wingOn+wingOff+wingOn+wingOff+wingOn+wingOff){
digitalWrite(rightwingtip,LOW);
wingState=ninthOnPeriod;
}
break;
case ninthOnPeriod:
if(now-wingStartMillis>=wingOn+wingOff+wingOn+wingOff+wingOn+wingOff+wingOn+wingOff+wingOn+wingOff+wingOn+wingOff+wingOn+wingOff+wingOn){
wingState=longInterval;
}
break;
case longInterval:
if (now-wingStartMillis>=wingOn+wingOff+wingOn+wingOff+wingOn+wingOff+wingOn+wingOff+wingOn+wingOff+wingOn+wingOff+wingOn+wingOff+wingOn+wingOff){
wingState=firstOnPeriod;
wingStartMillis=now;
}
break;
}
switch (revolve1State){
case Fade1:
if (now-fade1StartMillis >= Fade1On)
{
revolve1State=Off;
digitalWrite(revolving1, LOW);
}
else
{
revolving1time = now - fade1StartMillis;
value = 128 - 128*cos((2*PI*(float)revolving1time)/revolving1periode);
analogWrite(revolving1, value);
}
break;
case Off:
if (now-fade1StartMillis > Fade1On + Fade1Off)
{
revolve1State=Fade1;
fade1StartMillis=now;
}
break;
}
switch (revolve2State){
case Fade2:
if (now-fade2StartMillis >= Fade2On)
{
revolve2State=Off2;
digitalWrite(revolving2, LOW);
}
else
{
revolving2time = now - fade2StartMillis;
value = 128 - 128*cos((2*PI*(float)revolving2time)/revolving2periode);
analogWrite(revolving2, value);
}
break;
case Off:
if (now-fade2StartMillis > Fade2On + Fade2Off)
{
revolve2State=Fade2;
fade2StartMillis=now;
}
break;
}
}
Moderator edit:
</mark> <mark>[code]</mark> <mark>
</mark> <mark>[/code]</mark> <mark>
tags added.
Linker bug (easily resolved)...
http://code.google.com/p/arduino-tiny/issues/list?can=1&q=R_AVR_13_PCREL
http://code.google.com/p/arduino-tiny/issues/detail?id=58
https://www.google.com/search?q=R_AVR_13_PCREL%20site%3Aarduino.cc%2Fforum
http://forum.arduino.cc/index.php?topic=116674.5
Fix for the linker bug + instructions:
I will try this out when I get home today! I hope it works “like magic”!
Dave
Yes it was that easy! Something was missing during the first down load this was why I could not get it to work. After the second time it worked just fine!
Dave