Advertisement
Guest User

Untitled

a guest
Jun 3rd, 2025
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. #include <Arduino.h>
  2. #include <Adafruit_Sensor.h>
  3. #include <DHT.h>
  4. #include <Adafruit_GFX.h>
  5. #include <Adafruit_ST7735.h>
  6. #include <SPI.h>
  7.  
  8. #define TFT_CS 7
  9. #define TFT_RST 0
  10. #define TFT_DC 1
  11. #define TFT_LED 3
  12.  
  13. const uint16_t Color_Black = 0x0000;
  14. const uint16_t Color_Blue = 0x001F;
  15. const uint16_t Color_Red = 0xF800;
  16. const uint16_t Color_Green = 0x07E0;
  17. const uint16_t Color_Cyan = 0x07FF;
  18. const uint16_t Color_Magenta = 0xF81F;
  19. const uint16_t Color_Yellow = 0xFFE0;
  20. const uint16_t Color_White = 0xFFFF;
  21.  
  22. Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);
  23.  
  24. void setup() {
  25. Serial.begin(115200);
  26. dht.begin();
  27. Serial.println("DHT22 sensor initialized");
  28.  
  29. pinMode(TFT_LED, OUTPUT);
  30. analogWrite(TFT_LED, 200);
  31.  
  32. tft.initR(INITR_144GREENTAB);
  33.  
  34. Serial.println("TFT display initialized");
  35.  
  36. tft.setFont();
  37. tft.fillScreen(Color_White);
  38. }
  39.  
  40. void loop() {
  41. delay(2000);
  42. Serial.println("Starting loop");
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement