Hello,
I am using an AVR Pocket Programmer to program an ATtiny85. I am able to successfully upload code to the microcontroller, but I am experiencing difficulty with serial communication. I keep getting the error "Serial was not declared in this scope". I have tried following numerous tutorials, but can't seem to find the solution. I am trying to read the analog output from a light sensor, thanks for your help!
Here is my code:
int led0 = 0;
int led1 = 1;
int led2 = 2;
int lightPin = A3;
int lightReading;
void setup(void) {
Serial.begin(9600);
pinMode(led0, OUTPUT);
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(lightPin, INPUT);
}
void loop(void) {
lightReading = analogRead(lightPin);
Serial.print("Analog reading = ");
Serial.println(lightReading);
digitalWrite(0, HIGH); // turn the LED on (HIGH is the voltage level)
digitalWrite(1, HIGH); // turn the LED on (HIGH is the voltage level)
digitalWrite(2, HIGH); // turn the LED on (HIGH is the voltage level)
delay(500); // wait for a second
digitalWrite(0, LOW); // turn the LED on (HIGH is the voltage level)
digitalWrite(1, LOW); // turn the LED on (HIGH is the voltage level)
digitalWrite(2, LOW); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
}