serial monitor shows cryptic chars/strings

Hi,

i have watched nearly every tutorial and example i could find, but somehow i can't figure out, why the serial-monitor shows me those cryptic chars(?)

I use this potentiometer:
https://www.conrad.de/de/leitplastik-potentiometer-mono-100-k-tt-electronics-ab-p160kn-0fc20-b-100-kr-1-st-452811.html

can please someone help me?

Use Serial.print() or Serial.println() instead of Serial.write()

And you may want to change kein zeilenende (no line ending) to include new line and carriage return (Both NL & CR), should be the last option.

And for straight read/print stuff like that, you may want to include a
delay(1000);

at the end so you space out the readings and don't flood the serial monitor.

Hey thank you very much, now I get values.

But should analog-values not be between 0-1023 ? I get only wierd random values changing all the time between 0 - ~200.
When I rotate the potentiometer, whatever direction, all the same.. only a ton of random values

Somehow I have a problem with my potentiometers :confused:

I have tried some brand new ones.. this guys here:
https://www.conrad.de/de/leitplastik-potentiometer-mono-10-k-tt-electronics-ab-p160kn-0fc20-b-10-kr-1-st-452786.html

sticked into the breadborad and watch/readed all the tutorials, but same result with both.
What am I doing wrong?

What am I doing wrong?

Not posting your code, not posting a schematic?

the shematic is exactly this

https://qph.ec.quoracdn.net/main-qimg-3b294f2e74073525723aacf5e7587b2b?convert_to_webp=true

the code is

void setup() {
  Serial.begin(9600);
}

void loop() {  
 int sensorValue = analogRead(sensorPin);
 Serial.println(sensorValue)
}

AdmiralCrunch:
the shematic is exactly this

sp. "Fritzing diagram"

The code you posted doesn't compile. But you knew that.

AdmiralCrunch:
the code is

void setup() {

Serial.begin(9600);
}

void loop() { 
int sensorValue = analogRead(sensorPin);
Serial.println(sensorValue)
}

What pin is your potentiometer out plugged into?
And why doesn't your code mention it anywhere?
You've taken steps backward from the first post.
And you're missing a ;
as the IDE probably told you.

Your first picture with code shows you are reading A0, and your schematic shows pot plugged into A2.

oh sorry, you're all right.. :confused:

.. i did a little chaos here.. thats because i'm trying and trying every combination all with the same results.

ok, here is the actual code:

int sensorPin = A2;


void setup() {
  Serial.begin(9600);
}

void loop() {  
 int sensorValue = analogRead(sensorPin);
 Serial.println(sensorValue);
}

the shema is

poti pins: UNO:
1 ----------- 5V
2 ----------- A2
3 ----------- GND

change

int sensorPin = A2;

to

#define sensorPin A2

copy it exactly.

int data type prob not liking the letter A.

INTP:
change

int sensorPin = A2;

to

#define sensorPin A2

copy it exactly.

int data type prob not liking the letter A.

That is b..... ; anyway, in this case the compiler would complain if it was wrong.

From pins_arduino.h, A2 is a const variable

static const uint8_t A2 = 16;

From pins_arduino.h, A2 is a const variable

static const uint8_t A2 = 16;

Not for all Arduinos.

PaulS:
Not for all Arduinos.

OK 8) It was already a mission to find A2 (should have done a case sensitive grep so I would not have been slapped with e.g all the Atmega2560 references :frowning: )

INTP:
change

int sensorPin = A2;

to

#define sensorPin A2

copy it exactly.

no changes at all .. :confused:

the curious thing is, when I pull the wire connected to the poti-middle-pin (2) out of the breadboard and touch the end with my finger, the values seems get down to ~0 ..I have tried all combinations that I could imagine, but with no effort. It somehow can't be, that they sold me 6 potis, all damaged(?)

Not sure how you wired your pot, there isn't a universally understood thing where which pin is which when facing which way afaik.

Try switching 5V and GND around.
Show what your serial monitor is showing.
Make sure you're on the right COM port while you're at it.

I have finally figured it out :smiley:

the +/- -part of the breadboard is seperated in two independent circuits.
I have connetcted my 5v and GND on the left side.. but always testes my potentiometers on the right side of the breadboard -.- .. so there was no current and no ground to my potentiometer

AdmiralCrunch:
no changes at all .. :confused:

Of course not,see reply #11

But glad you got it working.