Moin,
habe ein Poti an Analoginput angeschlossen und der liefert saubere werte
zwischen 0 und 1023.
Habe leider noch kein Oszilloskop zur Verfügung.
Spannungsversorgung erfolgt über 5V und GND vom Arduino Board.
Die Software ist von Arduino als Beispielcode: AnalogInOutSerial
Hier nochmal der Code. Foto im Anhang
1 | const int analogInPin = A0; // Analog input pin that the potentiometer is attached to
|
2 | const int analogOutPin = 9; // Analog output pin that the LED is attached to
|
3 |
|
4 | int sensorValue = 0; // value read from the pot
|
5 | int outputValue = 0; // value output to the PWM (analog out)
|
6 |
|
7 | void setup() {
|
8 | // initialize serial communications at 9600 bps:
|
9 | Serial.begin(9600);
|
10 | }
|
11 |
|
12 | void loop() {
|
13 | // read the analog in value:
|
14 | sensorValue = analogRead(analogInPin);
|
15 | // map it to the range of the analog out:
|
16 | outputValue = map(sensorValue, 0, 1023, 0, 255);
|
17 | // change the analog out value:
|
18 | analogWrite(analogOutPin, outputValue);
|
19 |
|
20 | // print the results to the serial monitor:
|
21 | Serial.print("sensor = " );
|
22 | Serial.print(sensorValue);
|
23 | Serial.print("\t output = ");
|
24 | Serial.println(outputValue);
|
25 |
|
26 | // wait 2 milliseconds before the next loop
|
27 | // for the analog-to-digital converter to settle
|
28 | // after the last reading:
|
29 | delay(2);
|
30 | }
|
Danke schonmal für die Hilfe