// Mise en oeuvre d'un écran TFT #include ////////////// TFT SCREEN ////////// #include #include #include #include #define SCREEN_WIDTH 128 // OLED display width, in pixels #define SCREEN_HEIGHT 64 // OLED display height, in pixels // Declaration for an SSD1306 display connected to I2C (SDA, SCL pins) #define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin) Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET); ///////////////////////////// void setup() { Serial.begin(115200); //analogWriteResolution(LED_BUILTIN, 12); //pinMode(23, INPUT); //pinMode(35, INPUT); //pinMode(34, INPUT); ///////////// TFT DISPLAY ///////////// // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { Serial.println(F("SSD1306 allocation failed")); for (;;); // Don't proceed, loop forever } // Show initial display buffer contents on the screen -- // the library initializes this with an Adafruit splash screen. display.display(); delay(1000); // Pause for 1 second // Clear the buffer display.clearDisplay(); //////////////////////////////// } void loop() { // Serial.println("testing"); //sensorValue = analogRead(23); //Serial.println(sensorValue); // sensorValue = analogRead(34); //Serial.println(sensorValue); // sensorValue = analogRead(35); //Serial.println(sensorValue); //sensorValue = map(sensorValue,0,4095,0,255); //analogWrite(LED_BUILTIN, sensorValue); // Display values on the screen display.clearDisplay(); display.setTextSize(1); // Normal 1:1 pixel scale display.setTextColor(WHITE); // Draw white text display.setCursor(5, 0); display.print(F("bonjour"));// Start at top-left corner display.setCursor(5, 16); display.setTextSize(2); // Draw 2X-scale text display.setTextColor(WHITE); // display.invertDisplay(true); display.println(F("Ecran")); display.setCursor(5, 40); display.println("TFT"); display.display(); delay(50); } // Fin del loop