Some small projects (pierre  @ clatot.eu)
Published

A random number is displayed on an ILI9341

Arduino draws a random number which is displayed on an ILI9341

BeginnerFull instructions provided100
A random number is displayed on an ILI9341

Things used in this project

Hardware components

ILI9341
×1
Resistor 10k ohm
Resistor 10k ohm
×1

Story

Read more

Schematics

Schematic

The schematic

Code

CODE

Arduino
This is the random number code.
#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"

// For the Adafruit shield, these are the default.
#define TFT_DC A3
#define TFT_CS A5
#define  TFT_RST A4
#define TFT_MISO 12
#define TFT_MOSI 11
#define TFT_CLK 13
int data;

// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
// Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
// If using the breakout, change pins as desired
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);

void setup() {
  Serial.begin(9600);
  Serial.println("ILI9341 Test!"); 
  tft.begin();
  randomSeed(analogRead(A1));
  tft.fillScreen(ILI9341_BLACK);
}
void loop() {
data = random(0, 200);
  tft.setRotation(3);
   tft.setCursor(0, 0);
   tft.setTextSize(17);
   tft.print(data);
   delay(1000);
    tft.fillScreen(ILI9341_BLACK);
}

Credits

Some small projects (pierre  @ clatot.eu)
5 projects • 1 follower

Comments