Here is the solution
Guys, I have a new concept to realize my project but I need your help.
I create a Arrays in my code. There a two fields / two measurement:
Val = x / the first measurement from analog pin
Val = y / the second measurement from analog pin
If the two value unequal
int pwm = (y / 4);
The Idea is to compare two consecutive value instead of to save the value (if you see my first code concept)
Here is the code but it doesn’t work, the arduino programm displays an error:
sketch_sep22a:2: error: initializer fails to determine size of 'val'
sketch_sep22a:2: error: array must be initialized with a brace-enclosed initializer
initializer fails to determine size of 'val'
int ledPin = 9; // LED connected to digital pin 9
float val = 1; // potentiometer connected to analog pin 1
pinMode(ledPin, OUTPUT); // sets the pin as output
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
if (val != val) // compares the values
int pwm = (val / 4); //create pwm-signal