Hello,
I was wondering if anyone had any advice on making an object move forward and backwards using buttons or joystick. I just dont know how to connect with the object.
This is the code, i know i have no controller yet.
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library for ST7735
#include <Adafruit_ST7789.h> // Hardware-specific library for ST7789
#include <SPI.h>
#if defined(ARDUINO_FEATHER_ESP32) // Feather Huzzah32
#define TFT_CS 14
#define TFT_RST 15
#define TFT_DC 32
#elif defined(ESP8266)
#define TFT_CS 4
#define TFT_RST 16
#define TFT_DC 5
#else
// For the breakout board, you can use any 2 or 3 pins.
// These pins will also work for the 1.8" TFT shield.
#define TFT_CS 10
#define TFT_RST 9 // Or set to -1 and connect to Arduino RESET pin
#define TFT_DC 8
#endif
Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST);
float p = 3.1415926;
void setup(void) {
Serial.begin(115200);
tft.init(135, 240);
uint16_t time = millis();
tft.fillScreen(ST77XX_BLACK);
testlines(ST77XX_YELLOW);
delay(500);
}
void loop() {
}
void testlines(uint16_t color) {
tft.fillScreen(ST77XX_BLACK);
for (int16_t x=0; x < tft.width(); x+=0) {
tft.drawLine(0, 0, x, tft.height()-1, color);
tft.drawRect(3, 3, 20, 20, ST7735_WHITE);
delay(0);
}
}
Any help would be wonderful:)