i m trying to code attiny85 using software serial library .
I used myserial.println to transmit the value serially but it is showing m this error
This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
Arduino: 1.0.6 (Windows NT (unknown)), Board: "ATtiny85 (internal 8 MHz clock)"
f:/arduino-1.0.6/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o:(.init9+0x2): relocation truncated to fit: R_AVR_13_PCREL against symbol `exit' defined in .fini9 section in f:/arduino-1.0.6/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/avr25\libgcc.a(_exit.o)
But when i dont use myserial.println the ide shows no error .
What should i do?
Here is a the code i used
#include <SoftwareSerial.h>
#define rxPin 0
#define txPin 1
int val=0;
//int analogInPin = 3;
//float sensorValue = 0;
//int finalValue=0;
#define THERMISTORPIN 3
// resistance at 25 degrees C
#define THERMISTORNOMINAL 2252
// temp. for nominal resistance (almost always 25 C)
#define TEMPERATURENOMINAL 25
// how many samples to take and average, more takes longer
// but is more 'smooth'
#define NUMSAMPLES 5
// The beta coefficient of the thermistor (usually 3000-4000)
#define BCOEFFICIENT 4500
// the value of the 'other' resistor
#define SERIESRESISTOR 750
int samples[NUMSAMPLES];
SoftwareSerial myserial(rxPin, txPin);
void setup()
{
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
myserial.begin(9600);
//analogReference(EXTERNAL);
}
void loop()
{
val=myserial.read();
if(val>0)
{
int i;
float average;
// take N samples in a row, with a slight delay
for (i=0; i< NUMSAMPLES; i++)
{
samples[i] = analogRead(THERMISTORPIN);
delay(10);
}
// average all the samples out
average = 0;
for (i=0; i< NUMSAMPLES; i++)
{
average += samples[i];
}
average /= NUMSAMPLES;
average = 1023 / average - 1;
average = SERIESRESISTOR / average;
float steinhart=0;
int steinhartfinal=0;
steinhart = average / THERMISTORNOMINAL; // (R/Ro)
steinhart = log(steinhart); // ln(R/Ro)
steinhart /= BCOEFFICIENT; // 1/B * ln(R/Ro)
steinhart += 1.0 / (TEMPERATURENOMINAL + 273.15); // + (1/To)
steinhart = 1.0 / steinhart; // Invert
steinhart -= 273.15;
steinhartfinal=steinhart*100;
myserial.println(steinhartfinal);
delay(500);
}
}