weird stuff happening with sensor program o_0

steps to test (I understood that it partly works and the problems are fluctuations, but nevertheless):

  • remove for a moment the analogWrite(led, outputValue); and see if it becomes stable
  • Connect analog 1 to gnd, does it read 0
  • Connect analog 1 to VCC or also to 3.3, does it read 1023 (or for 3.3V around 675 give and take a bit)
  • Connected something odd to AREF?
  • Tried another pin?
  • if you put the sensor and a free wire to analog 1, does it fluctuate when you touch the wire?
  • is it analog 1 or the 1st analog in?
  • recheck the wiring!