Go Down

Topic: Arduino Pro Mini - Upload doesn't change anything on OLED Display (Read 694 times) previous topic - next topic

TimeMen

Hey there,

I have an Arduino Pro Mini, a BTE13-007 Adapter and an OLED Display with 0,96".
I want to see some values of my KPM-36 sensor, but there's a little problem.

This is my code so far:
Code: [Select]

#include <Adafruit_SSD1306.h>
#include <Adafruit_GFX.h>
#include <SPI.h>
#include <Wire.h>

#define OLED_RESET 4 // not used / nicht genutzt bei diesem Display
Adafruit_SSD1306 display(OLED_RESET);

int sensorPin = A0;

void setup() {
  pinMode(sensorPin, INPUT);
  Serial.begin(19200);
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
  display.clearDisplay();
  display.setCursor(1, 0);
  display.println("  Initialisiere...");
  delay(2000);
}

void loop() {               
  int reading = analogRead(sensorPin); 
  float voltage = reading * 5.0;
  voltage /= 1024.0;
  float temperatureC = (voltage - 0.5) * 100;
  Serial.println(temperatureC);

  display.clearDisplay();
  display.setTextColor(WHITE);
  display.setTextSize(1);
  display.setCursor(1,0);
  // display.println("OLED - Display - Test");
  display.setTextSize(2);
  display.setCursor(34,15);
  display.print(temperatureC);
  display.println("C");
  delay(10);
  display.display();
  display.clearDisplay();
}


The sketch is doing his job well, but if i change something in the code, the arduino wouldn't change anything on the display after the upload. If I change the text which should be printed on the OLED, there wouldn't be sth. different on the display. Nothing changes.

Where is the problem? Is there anything wrong in the sketch, or is it a hardware problem.
Bild zu groß?
user@hostname:~/$ mogrify -resize 1024x768 *.jpg

Free software for a free world.
Free software for free people.

Go Up