I am having an issue with the serial monitor. I am just trying to output the value from a potentiometer that should be between 0-1023. I have even tried just printing the word Hello, but it comes out all weird. The following is my code:
int sensorPin = A5; //this is for analog pin A0
int LED1 = 13;
int sensorValue;
int LED2 = 12;
int LED3 = 11;
void setup() {
// put your setup code here, to run once:
pinMode(LED1, OUTPUT);
pinMode(LED2, OUTPUT);
pinMode(LED3, OUTPUT);
Serial.println("Beginning Program");
}
void loop() {
// put your main code here, to run repeatedly:
sensorValue = analogRead(sensorPin);
Serial.begin(9600);
digitalWrite(LED1, HIGH); //Turn led on
delay(sensorValue); //pause for sensorValue
//millisecond
digitalWrite(LED1, LOW); //turn led off
delay(sensorValue); //milliseconds
digitalWrite(LED2, HIGH); //Turn led on
delay(sensorValue); //pause for sensorValue
//millisecond
digitalWrite(LED2, LOW); //turn led off
delay(sensorValue); //milliseconds
digitalWrite(LED3, HIGH); //Turn led on
delay(sensorValue); //pause for sensorValue
//millisecond
digitalWrite(LED3, LOW); //turn led off
delay(sensorValue); //milliseconds
Serial.println("HELLO");
}
And my output looks like this:
¤Ñ¦ú§Ã„ú£ú¦ú‡á¤Ñ¦ú§Ã„ú£úLO
I have tried changing the baud rate, but to no effect. I have tried changing the board, the cable, and the potentiometer. Does anyone have any ideas?