Hello there !
I have two questions about the code hereunder.
I try to do some basic test with an ATTiny85, Arduino IDE and usbasp programmer.
First the serial com only works if I set the Arduino IDE with 1 Mhz internal clock.
Did I have to change something in the code if I want to use 8 MHz or 16 MHz internal clock ?
I have assumed that the library will do that but obviously no...
Second : the value read at pin 7 an send by mySerial.println(val) stay constantly at 1023... Even If I connect pin 7 to GND or to +5V !!!
And I dont understand why

Any help greatly appreciated.
Regards
Philippe
#include <SoftwareSerial.h>
// For ATtiny85 : turn on led, analog read and serial com
// RESET | pin 1 pin 8| 5V
// 3/A3 | pin 2 pin 7| 2/A1
// 4/A2 | pin 3 pin 6| 1/PWM
// GND | pin 4 pin 5| 0/PWM
// for SoftwareSerial you must set up as internal clock // to free up physical pins 2 and 3.
// This will flash an LED on physical pin 6, read the analog value on pin 7, and send the
// analog value to the Serial Monitor for display.
const int LED = 1; // this is physical pin 6 for the LED
const int ANTENNA = 2; // this is physical pin 7, connect wire as antenna
const int Rx = 3; // this is physical pin 2
const int Tx = 4; // this is physical pin 3
SoftwareSerial mySerial(Rx, Tx);
int val = 0; // variable to store antenna readings
void setup()
{
pinMode(LED, OUTPUT); // tell LED is an output
pinMode(ANTENNA, INPUT); // tell ANTENNA is an input
mySerial.begin(9600); // send serial data at 9600 bits/sec
}
void loop()
{
digitalWrite(LED, HIGH); // turn LED ON
delay(500);
digitalWrite(LED, LOW); // turn off
delay(500);
val = analogRead(ANTENNA); // read the ANTENNA
mySerial.println("Test");
mySerial.println(val); // send the value to Serial Monitor, ^Cmd-M
digitalWrite(LED, HIGH); // turn LED ON
delay(100);
digitalWrite(LED, LOW); // turn off
delay(500);
}