r/arduino 7d ago

RGB led only mixes with blue and green

3 Upvotes

-PROBLEM SOLVED-

It seems that my red pin of my RGB led is not working properly. Now ive tested if the red pin is broken with multimeter, it was not, it lit up just fine. So i have all pins on pmw this is my code:

also i have a common cathode rgb led and everything is wired up just fine. So any suggestions on what is going on here?

int redPin= 9;
int greenPin = 6;
int bluePin = 5;


void setup() {
  pinMode(redPin, OUTPUT);
  pinMode(greenPin, OUTPUT);
  pinMode(bluePin, OUTPUT);
}


void loop() {
  setColor(255, 0, 0); // Red Color
  delay(1000);
  
  setColor(0, 255, 0); // Green Color
  delay(1000);
  
  setColor(0, 0, 255); // Blue Color
  delay(1000);
  
  setColor(255, 255, 0); // Yellow Color
  delay(1000);


  setColor(0, 255, 255); // Cyan Color
  delay(1000);
  
  setColor(255, 0, 255); // Magenta Color
  delay(1000);
  
  setColor(255, 165, 0); // Orange Color
  delay(1000);
  
  setColor(128, 0, 128); // Purple Color
  delay(1000);
  
  setColor(255, 255, 255); // White Color
  delay(1000);
}


void setColor(int redValue, int greenValue, int blueValue) {
  analogWrite(redPin, redValue);
  analogWrite(greenPin, greenValue);
  analogWrite(bluePin, blueValue);
}

r/arduino 7d ago

Hardware Help KY-024 Hall Sensor Problems

3 Upvotes

I'm using an Arduino Uno to test the KY-024 hall sensor. It appears to output a higher than normal voltage. I've tried swapping analog and digital pins, a bunch of codes, and moving the potentiometer. There seems to be a ~0.5V drop (reads ~4.5 when 5V used, ~2.8 when 3.3V used) between the sensor and the analog pin, not sure if that's a little odd. The hall effect sensor seems to be a 49E linear sensor, which should work from my knowledge. Anyone ever had this issue with one of these sensors? Any help is appreciated. Mind you, I did buy this from aliexpress so it could full well be faulty. Anyone ordered reliable modules for this before please drop the link below. Thanks!

Here's the code I was running as well. Pretty sure it was the demo code provided.

// Declaration and initialization of the input pin
int Analog_Eingang = A0; // X-axis-signal
int Digital_Eingang = 3; // Button


void setup ()
{
  pinMode (Analog_Eingang, INPUT);
  pinMode (Digital_Eingang, INPUT);


  Serial.begin (9600); // Serielle output with 9600 bps
}
// The program reads the current value of the input pins
// and output it via serial out
void loop ()
{
  float Analog;
  int Digital;


  // Current value will be read and converted to the voltage
  Analog = analogRead (Analog_Eingang) * (5.0 / 1023.0);
  Digital = digitalRead (Digital_Eingang);


  // and outputted here
  Serial.print ("Analog voltage value:"); Serial.print (Analog, 4); Serial.print ("V, ");
  Serial.print ("Extreme value:");
  if(Digital==1)
  {
  Serial.println (" reached");
  }
  else
  {
  Serial.println (" not reached yet");
  }
  Serial.println ("----------------------------------------------------------------");
  delay (200);
}

reading a pretty much constant voltage as I move a magnet closer and further from the sensor

+ plugged in 5V, - plugged in GND, A0 plugged in A0

r/arduino 7d ago

Update: Tetris on Arduino Mega (v2–Sound+Score+Game Over+Polish)

Thumbnail
youtube.com
10 Upvotes

I updated my Arduino Tetris project with several improvements:

New features in v2:

  • Sound effects (movement, rotation, line clear, game over)
  • Score system with TM1637 display
  • Game over animation (flashing full screen effect)
  • Improved row clearing animation
  • Better screen reset after restart
  • More stable rendering after transitions (fix for visual glitches)
  • Cleaner game loop structure

Sound system:

Each action now has feedback:

  • Move left/right → short beep
  • Rotate → higher beep
  • Line clear → ascending tone based on number of lines
  • Game over → long low tone

Fixes:

  • Fixed display desync after Game Over reset
  • Fixed rendering artifacts after clear animation
  • Improved buffer reset logic (screen vs board separation)
  • More stable timing for animations

Hardware:

  • Arduino Mega 2560
  • 2x MAX7219 8x8 LED matrices (16x8 display)
  • TM1637 7-segment display
  • Passive buzzer
  • 3 buttons (INPUT_PULLUP)

Notes:

This version focuses a lot on:

  • stable rendering (no ghost pixels after resets)
  • better game state handling
  • adding "game feel" with sound + animations

r/arduino 7d ago

Software Help ESP32-cam best image quality for not moving objects in low-light

Post image
6 Upvotes

Folks, I'm trying to make a cheap pool chemistry strip reader, so I've just setup a nice web-server and finally solved an issue with SDMMC conflict with LED flash controls (by switching to 1-wire to free up the SDMMC_D1 which is used for LED).

Now I want to take the best possible picture (OV3660) in black box (literally), which is lit just by the LED. What the sensor settings to use?

I thought I need to disable the auto-exposure and increase the exposure time to 1200, then disable the gain and maximum I'm getting is the attached picture, which is not enough for sure...

So how I can get the best picture quality without harming it by gain and other post-processing?


r/arduino 7d ago

Debugging My Arduino Power issue with a Low Voltage Transformer

7 Upvotes

I have been working on a small Arduino Uno project to power a set of sensors and LEDs. The setup uses a breadboard, basic resistors, and a low voltage transformer stepping down from mains to around 12V before regulation.

….the issue started when my readings became unstable after a few minutes. At first, i thought it was a coding problem, but after checking everything, the issue seemed power related. The voltage from the transformer was not as steady as I expected under load. I have done some research about this problem, looking even into technical specifications listed by suppliers, such as those on alibaba, but it does not help that much in reality. The specs looked fine, but my actual measurements told a different story.

So right now, I am using a basic linear regulator to step it down to 5V for the Arduino, but i am wondering if switching to a better regulated supply or adding proper filtering would stabilize things…. Kinda desperate right now

Has anyone here dealt with similar instability using low voltage transformers in small Arduino setups? I would really appreciate any suggestions on improving power consistency without overcomplicating the circuit.

Thank you so much.


r/arduino 8d ago

Hardware Help MG996Rs keep burning out

Thumbnail
gallery
43 Upvotes

Hello,

I'm currently working on a robot arm project and trying to get these MG996R servos, as attached, to work by spinning (I'm just testing them using a basic servo sketch right now). However, with each of the 4 servos I ordered and tested, still nothing has gone right. I have connected a common ground to the breadboard, edited the code millions of times, fixed all the loose wires, etc, but the servos keep burning. They work for a second or two and then just smoke out.

EDIT: power supply is adjustable from 3-12V

PA @ 6.0V

Apologies for the poor schematic.


r/arduino 7d ago

Hardware Help Problem with using MOSFET switch - Arduino is lighting pins that are connected to the board but not included in the sketch

3 Upvotes

I had an existing circuit using a common anode RGB LED and it was using pins 9, 10, 11 and Ground on my Arduino Mega. Powered by the 3.3 V on board.

I stopped using that but left it connected. I uploaded a completely different sketch using pin 8 to switch a MOSFET:

https://core-electronics.com.au/mosfet-power-switch-module.html

I'm using it to power a 24 V fog maker at 1 A. It works perfectly well, but I noticed when it was on I was getting random colours flashing intermittently on the RGB LED.

I eventually want to use these together. So, what could I be doing wrong?


r/arduino 8d ago

Why is this happening?

Thumbnail
gallery
38 Upvotes

When the motor is connected in the driver the LEDs become dims but when I take it off the LEDs are bright red. I don’t know why? Anybody know?

Edit: Ok so it’s on an Elegoo 5V supply module connected to an Arduino uno. I don’t know how much amps it’s outputting


r/arduino 8d ago

Solved! OLED DIsplay showing fragments

84 Upvotes

As you can see in the video, the text on my I2C OLED display seems to be behind some sort of artefact wall. I have tried all I can think of but nothing seems zondo anything.


r/arduino 7d ago

Look what I made! [ Removed by Reddit ]

0 Upvotes

[ Removed by Reddit on account of violating the content policy. ]


r/arduino 7d ago

[ Removed by Reddit ]

0 Upvotes

[ Removed by Reddit on account of violating the content policy. ]


r/arduino 8d ago

help with arduino nano please

Thumbnail
gallery
5 Upvotes

when i try to select plain arduino nano for my nano clone it says verify only and resets to arduino nano rp2040 connect or nano 33 ioT when i press nano


r/arduino 8d ago

How Can I creat GUI for MeArm robotic arm

0 Upvotes

I'm working on a school project and having trouble with GUI part.I need to show with GUI.I've no idea about how to do.Any advice?


r/arduino 7d ago

I accidentally 2x-overclocked a 6-color e-ink panel for 10 days because of one wrong byte.

Post image
0 Upvotes

TL;DR

  • I ran a 7.3" colour e-ink panel at 2× the rated PLL for 10 days without noticing — burned 30+ "discoveries" as overclock artifacts. Project is real-world functional now.
  • 25 days of bring-up on an Arduino UNO Q (Linux + MCU dual-brain), with Claude Code running on the Linux side and painting agent state to the panel.
  • Hardest lesson: trust the chip's OTP, not the schematic, and not the community gist.

The build

I wanted a physical surface that shows me what my coding agent is doing — token usage, current task, last command, error state. Not on my laptop monitor (I have IDE windows for that), but a separate, calm surface I can glance at while I pace.

Colour e-paper made sense: no backlight to fatigue my eyes during long sessions, persistent so the agent's state survives sleep, big enough for actual information.

The catch is e-paper is slow. A full DRF cycle on the 7.3" Spectra 6 panel is ~28 seconds. So most of the project became "how to only update what changed without losing colour fidelity."

The hardware ended up being a GDEP073E01 panel + DESPI-C73 adapter, driven over SPI from the UNO Q's MCU side, while the Linux side (QRB2210) runs the Python frame composer and talks to Claude Code over a unix socket.

How it works

Claude Code (Linux side on UNO Q)
    │ hooks fire on tool-use / completion / error
    ▼
unix socket -> dashboard daemon (Python)
    │ composes 800×480 colour frame
    ▼
SPI -> SPD1657A controller -> 7.3" panel

The daemon listens on a unix socket. Hooks in Claude Code push state events. The daemon composes the next frame and decides between a full refresh and a 1.5s partial.

What surprised me first

Sketch compiled. Uploaded. Terminal said "success." Screen did nothing.

Three invisible bugs stacked:

  • A background service silently overwrote my sketch
  • The flash tool wrote to the wrong partition
  • A key pin was already pre-assigned in the DTS

Took three days. This whole class of bug — where every tool reports success but nothing visibly fails — is the worst part of bringing up anything on a new SBC.

The controller is not what every gist says

The 7-colour e-paper code people copy-paste online targets the SPD1656. The GDEP073E01 actually ships with SPD1657A. They're only ~85% command-compatible. Half the "LUT unlock" tricks people share? Silently no-op on the SPD1657A.

I dumped the OTP memory on day 20 to find this out, using the 0xCD IC-version command. That single byte is the only honest way to know which controller you're really talking to. The schematic doesn't tell you. The datasheet PDFs are ambiguous. Only the chip is the source of truth.

The PLL byte that lied to me for 10 days

This is the part I'd warn anyone building on a new colour e-paper about.

The PLL register takes a one-byte value. I'd been sending 0x07. That happens to be a valid value — the panel refreshed, output colour, and I could reproduce my results consistently. So I assumed it was correct.

It wasn't. The vendor reference value is 0x08. Sending 0x07 runs the panel at 2× the rated PLL.

For 10 days, while overclocked, I'd been collecting "new palettes", "novel intensity levels", "codes that produce skin tones." I wrote them all up. Felt productive.

On day 25 I cross-checked one byte against the vendor reference driver. 30+ palette observations turned out to be overclock artifacts. 7 of my project notes got marked SUPERSEDED. 3 specific public claims retracted.

Everything was reproducible — until it wasn't.

The reordering trick that halved refresh time

While I was at it, another rule fell out. The Panel Setting register (PSR) must be the very first command after raw_reset. Send it one position later and the controller's state machine takes the slow path — refresh time jumps from 28s to 46s.

Reordering a single command got it back to 28s. Halved refresh time, zero hardware change.

What survived

After the PLL pullback, the 7 production recipes that actually hold up:

  • K/W/Y/R/Y/B/G/Y baseline (the 8 native codes)
  • Native orange via a PSR.B register flip
  • Vivid red via VCMZ=1
  • 1.5s partial refresh path
  • Two-pass overprinting pushes effective gamut from 8 → ~16 perceived colours
  • (Plus two more tied to specific waveforms I'm still tuning)

What I'd do differently on a new SBC

  • Read OTP / chip-version registers on day 1, not day 20. Trust the chip, not the schematic, not the gists.
  • For every register, log "expected, default, what I sent" to a CSV. The wrong PLL byte would have been caught day 1, not day 25.
  • Lock down a "vendor canonical" mode early and only deviate intentionally. Off-canonical exploration mixes signal with artifacts, and you can't tell which is which until you reset.

Full write-up with OTP dumps, per-phase logs, and screenshots from the whole 25 days: https://hackaday.io/project/205770

Happy to answer questions about UNO Q bring-up, the Linux/MCU split, or the SPD1657A driver gotchas.


r/arduino 8d ago

Hardware Help Keep burning up mux chips after a weeks/months. Am I not understanding ADCx pin functionality?

7 Upvotes

Arduino UNO R4 WiFi. I built a system to measure 32 analog signals on ADC0 and ADC1 using two 16:1 muxes. It works great for a few weeks or even months, then the mux chips start malfunctioning. I replace the mux (CD74HC4067) chip and it works again for awhile. I'm running 16 analog signals through the mux (0-5 Vp-p). The Arduino program sets ADC0-ADC1 as input when the system is initialized, then just loops reading analog inputs, doing calculations and sending data via wifi. I just leave the analog signals sitting on the ADC0 and ADC1 port even when I'm not sampling, so I'm wondering if maybe the pin switches functionality somehow and sets an output signal at 0v or 5V, which might cause excess current through my mux chip and keep burning them up. (I'm pulling my hair out trying to figure out why the mux chips keep malfunctioning after awhile)

Question: If I set the ADC0 and ADC1 pins as inputs during initialization, will they ever change functionality and throw a voltage (i.e. become D14 or something) on the pin during other operations?

EDIT: Thanks for the help. The analog inputs aren't causing my issues and it looks like I'll need to redesign my board to account for transients among other things.


r/arduino 8d ago

Solved! Arduino Nano Every Board + Adafruit A4988 Stepper + Nema 17 Motor Not Getting Power

Post image
5 Upvotes

Arduino Nano Every Board + Adafruit A4988 Stepper + Nema 17 Motor Not Getting Power

Hello,

Very new to electronics but having a good time.

I’m wondering if someone would be able to help me troubleshoot.

I have my arduino Nano Every Board connected to my breadboard along with my Adafruit A4988 stepper, Nema 17 Motor, and 100uF 35V capacitor.

Right now, I have my power supply connected to the rails on the right, then a capacitor on those rails.

From there, I have connections going from the rails, to my VIN and GND on my Arduino.

From there, I have my 5V going from my nano to the VDD pin on my 4988 stepper.

I have the GND, on the other side of the Arduino, connected to the GND on the A4988.

I have the DIR on the A4988 connected to D2 and Step on the A4988 connected to D3.

I have all 4 wires from the motor, connected to the A4988 and nothing connected to the + or - of the A4988.

When I plug in my power supply, I am not getting power to either the Arduino or the A4988.

Can anyone help me figure out what I need to do in order to get power?


r/arduino 8d ago

Hardware Help R4 Wifi clone : Upload problem

3 Upvotes

Hi, so I have an R4 WiFi clone that worked flawlessly for a few months, but suddenly, it’s now impossible to upload to.

I’ve checked the IDE version, data transfer speed, USB cable, double-pressed the reset button, tried 3 different computers, etc., etc., but nothing helped. So if you guys have any idea of what may have happened, I’m willing to hear it!

Thanks in advance!


r/arduino 8d ago

Hardware Help I2C LCD showing nothing? Here's the checklist that actually fixes it

3 Upvotes

Spent way too long debugging a blank I2C LCD before I figured out the pattern. 99% of the time it's one of these:

  1. Wrong I2C address — run a scanner, it's almost never 0x27

  2. Contrast pot hasn't been adjusted (the one on the back of the module)

  3. Pulling 3.3V instead of 5V 4. SDA/SCL swapped — A4 and A5 on Uno, easy to mix up

Put together a short walkthrough if anyone wants to see the process: https://youtu.be/vsmw732YIto?si=_v-zjtzIxi9PvRDg

What's the weirdest LCD bug you've run into?


r/arduino 8d ago

Online Perfboard Website Recs??

2 Upvotes

I am looking to start making my electronics projects more permanents, and transition from breadboard to soldering a perfboard.

I already bought my own soldering iron, but I am looking for some cheap, quality perfboards I can get online. Does anyone have any recommendations for where I can find them, or any advice as to what to look for and what to avoid when buying?


r/arduino 8d ago

Software Help arduino , linear actuator, and joystick

4 Upvotes

so i've been tryna make a device where a linear actuator moves with an arduino uno and a joystick.

My diagram is this and is it ok? Sorry is the diagraam is too weird

the code is

const int joystickPin = A1; 
const int IN1 = 9; 
const int IN2 = 10; 
int centerValue = 512; 
const int threshold = 50; 

void setup() {
  pinMode(IN1, OUTPUT);
  pinMode(IN2, OUTPUT);
  
  delay(200);
  centerValue = analogRead(joystickPin);
}

void loop() {
  int joyVal = analogRead(joystickPin);
  
  if (joyVal > (centerValue + threshold)) {
digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
  }
  else if (joyVal < (centerValue - threshold)) {
digitalWrite(IN1, LOW);
digitalWrite(IN2, HIGH);
  }
  else {
digitalWrite(IN1, LOW);
digitalWrite(IN2, LOW);
  }
  delay(10);
}

the problem is, it doesnt work. it works without the joystick and another code but for this, it doesnt work.:(
can i ask for help?


r/arduino 8d ago

Software Help MCU"ESP32-S3 DevKitC-1 N16R8 Modul" with Display "3.5inch SPI Module ILI9488 SKU:MSP3520".

1 Upvotes

Hi,

I want to use an MCU"ESP32-S3 DevKitC-1 N16R8 Modul" with Display "3.5inch SPI Module ILI9488 SKU:MSP3520".

Used library: https://github.com/Bodmer/TFT_eSPI

Unfortunately it didn't work.

Display light was on, it was visible bright, but no text, no colour.

It doesn't matter which program I uploaded.

Current Program:

/*
 Adapted from the Adafruit graphicstest sketch, see original header at end
 of sketch.


 This sketch uses the GLCD font (font 1) only.


 Make sure all the display driver and pin connections are correct by
 editing the User_Setup.h file in the TFT_eSPI library folder.


 #########################################################################
 ###### DON'T FORGET TO UPDATE THE User_Setup.h FILE IN THE LIBRARY ######
 #########################################################################
*/



#include "SPI.h"
#include "TFT_eSPI.h"


TFT_eSPI tft = TFT_eSPI();


unsigned long total = 0;
unsigned long tn = 0;
void setup() {
  Serial.begin(9600);
  while (!Serial);


  Serial.println(""); Serial.println("");
  Serial.println("TFT_eSPI library test!");


  tft.init();


  tn = micros();
  tft.fillScreen(TFT_BLACK);


  yield(); Serial.println(F("Benchmark                Time (microseconds)"));


  yield(); Serial.print(F("Screen fill              "));
  yield(); Serial.println(testFillScreen());
  //total+=testFillScreen();
  //delay(500);


  yield(); Serial.print(F("Text                     "));
  yield(); Serial.println(testText());
  //total+=testText();
  //delay(3000);


  yield(); Serial.print(F("Lines                    "));
  yield(); Serial.println(testLines(TFT_CYAN));
  //total+=testLines(TFT_CYAN);
  //delay(500);


  yield(); Serial.print(F("Horiz/Vert Lines         "));
  yield(); Serial.println(testFastLines(TFT_RED, TFT_BLUE));
  //total+=testFastLines(TFT_RED, TFT_BLUE);
  //delay(500);


  yield(); Serial.print(F("Rectangles (outline)     "));
  yield(); Serial.println(testRects(TFT_GREEN));
  //total+=testRects(TFT_GREEN);
  //delay(500);


  yield(); Serial.print(F("Rectangles (filled)      "));
  yield(); Serial.println(testFilledRects(TFT_YELLOW, TFT_MAGENTA));
  //total+=testFilledRects(TFT_YELLOW, TFT_MAGENTA);
  //delay(500);


  yield(); Serial.print(F("Circles (filled)         "));
  yield(); Serial.println(testFilledCircles(10, TFT_MAGENTA));
  //total+= testFilledCircles(10, TFT_MAGENTA);


  yield(); Serial.print(F("Circles (outline)        "));
  yield(); Serial.println(testCircles(10, TFT_WHITE));
  //total+=testCircles(10, TFT_WHITE);
  //delay(500);


  yield(); Serial.print(F("Triangles (outline)      "));
  yield(); Serial.println(testTriangles());
  //total+=testTriangles();
  //delay(500);


  yield(); Serial.print(F("Triangles (filled)       "));
  yield(); Serial.println(testFilledTriangles());
  //total += testFilledTriangles();
  //delay(500);


  yield(); Serial.print(F("Rounded rects (outline)  "));
  yield(); Serial.println(testRoundRects());
  //total+=testRoundRects();
  //delay(500);


  yield(); Serial.print(F("Rounded rects (filled)   "));
  yield(); Serial.println(testFilledRoundRects());
  //total+=testFilledRoundRects();
  //delay(500);


  yield(); Serial.println(F("Done!")); yield();
  //Serial.print(F("Total = ")); Serial.println(total);
  
  //yield();Serial.println(millis()-tn);
}


void loop(void) {
  for (uint8_t rotation = 0; rotation < 4; rotation++) {
    tft.setRotation(rotation);
    testText();
    delay(2000);
  }
}



unsigned long testFillScreen() {
  unsigned long start = micros();
  tft.fillScreen(TFT_BLACK);
  tft.fillScreen(TFT_RED);
  tft.fillScreen(TFT_GREEN);
  tft.fillScreen(TFT_BLUE);
  tft.fillScreen(TFT_BLACK);
  return micros() - start;
}


unsigned long testText() {
  tft.fillScreen(TFT_BLACK);
  unsigned long start = micros();
  tft.setCursor(0, 0);
  tft.setTextColor(TFT_WHITE);  tft.setTextSize(1);
  tft.println("Hello World!");
  tft.setTextColor(TFT_YELLOW); tft.setTextSize(2);
  tft.println(1234.56);
  tft.setTextColor(TFT_RED);    tft.setTextSize(3);
  tft.println(0xDEADBEEF, HEX);
  tft.println();
  tft.setTextColor(TFT_GREEN);
  tft.setTextSize(5);
  tft.println("Groop");
  tft.setTextSize(2);
  tft.println("I implore thee,");
  //tft.setTextColor(TFT_GREEN,TFT_BLACK);
  tft.setTextSize(1);
  tft.println("my foonting turlingdromes.");
  tft.println("And hooptiously drangle me");
  tft.println("with crinkly bindlewurdles,");
  tft.println("Or I will rend thee");
  tft.println("in the gobberwarts");
  tft.println("with my blurglecruncheon,");
  tft.println("see if I don't!");
  return micros() - start;
}


unsigned long testLines(uint16_t color) {
  unsigned long start, t;
  int           x1, y1, x2, y2,
                w = tft.width(),
                h = tft.height();


  tft.fillScreen(TFT_BLACK);


  x1 = y1 = 0;
  y2    = h - 1;
  start = micros();
  for (x2 = 0; x2 < w; x2 += 6) tft.drawLine(x1, y1, x2, y2, color);
  x2    = w - 1;
  for (y2 = 0; y2 < h; y2 += 6) tft.drawLine(x1, y1, x2, y2, color);
  t     = micros() - start; // fillScreen doesn't count against timing
  yield();
  tft.fillScreen(TFT_BLACK);


  x1    = w - 1;
  y1    = 0;
  y2    = h - 1;
  start = micros();
  for (x2 = 0; x2 < w; x2 += 6) tft.drawLine(x1, y1, x2, y2, color);
  x2    = 0;
  for (y2 = 0; y2 < h; y2 += 6) tft.drawLine(x1, y1, x2, y2, color);
  t    += micros() - start;
  yield();
  tft.fillScreen(TFT_BLACK);


  x1    = 0;
  y1    = h - 1;
  y2    = 0;
  start = micros();
  for (x2 = 0; x2 < w; x2 += 6) tft.drawLine(x1, y1, x2, y2, color);
  x2    = w - 1;
  for (y2 = 0; y2 < h; y2 += 6) tft.drawLine(x1, y1, x2, y2, color);
  t    += micros() - start;
  yield();
  tft.fillScreen(TFT_BLACK);


  x1    = w - 1;
  y1    = h - 1;
  y2    = 0;
  start = micros();
  for (x2 = 0; x2 < w; x2 += 6) tft.drawLine(x1, y1, x2, y2, color);
  x2    = 0;
  for (y2 = 0; y2 < h; y2 += 6) tft.drawLine(x1, y1, x2, y2, color);
  yield();
  return micros() - start;
}


unsigned long testFastLines(uint16_t color1, uint16_t color2) {
  unsigned long start;
  int           x, y, w = tft.width(), h = tft.height();


  tft.fillScreen(TFT_BLACK);
  start = micros();
  for (y = 0; y < h; y += 5) tft.drawFastHLine(0, y, w, color1);
  for (x = 0; x < w; x += 5) tft.drawFastVLine(x, 0, h, color2);


  return micros() - start;
}


unsigned long testRects(uint16_t color) {
  unsigned long start;
  int           n, i, i2,
                cx = tft.width()  / 2,
                cy = tft.height() / 2;


  tft.fillScreen(TFT_BLACK);
  n     = min(tft.width(), tft.height());
  start = micros();
  for (i = 2; i < n; i += 6) {
    i2 = i / 2;
    tft.drawRect(cx - i2, cy - i2, i, i, color);
  }


  return micros() - start;
}


unsigned long testFilledRects(uint16_t color1, uint16_t color2) {
  unsigned long start, t = 0;
  int           n, i, i2,
                cx = tft.width()  / 2 - 1,
                cy = tft.height() / 2 - 1;


  tft.fillScreen(TFT_BLACK);
  n = min(tft.width(), tft.height());
  for (i = n - 1; i > 0; i -= 6) {
    i2    = i / 2;
    start = micros();
    tft.fillRect(cx - i2, cy - i2, i, i, color1);
    t    += micros() - start;
    // Outlines are not included in timing results
    tft.drawRect(cx - i2, cy - i2, i, i, color2);
  }


  return t;
}


unsigned long testFilledCircles(uint8_t radius, uint16_t color) {
  unsigned long start;
  int x, y, w = tft.width(), h = tft.height(), r2 = radius * 2;


  tft.fillScreen(TFT_BLACK);
  start = micros();
  for (x = radius; x < w; x += r2) {
    for (y = radius; y < h; y += r2) {
      tft.fillCircle(x, y, radius, color);
    }
  }


  return micros() - start;
}


unsigned long testCircles(uint8_t radius, uint16_t color) {
  unsigned long start;
  int           x, y, r2 = radius * 2,
                      w = tft.width()  + radius,
                      h = tft.height() + radius;


  // Screen is not cleared for this one -- this is
  // intentional and does not affect the reported time.
  start = micros();
  for (x = 0; x < w; x += r2) {
    for (y = 0; y < h; y += r2) {
      tft.drawCircle(x, y, radius, color);
    }
  }


  return micros() - start;
}


unsigned long testTriangles() {
  unsigned long start;
  int           n, i, cx = tft.width()  / 2 - 1,
                      cy = tft.height() / 2 - 1;


  tft.fillScreen(TFT_BLACK);
  n     = min(cx, cy);
  start = micros();
  for (i = 0; i < n; i += 5) {
    tft.drawTriangle(
      cx    , cy - i, // peak
      cx - i, cy + i, // bottom left
      cx + i, cy + i, // bottom right
      tft.color565(0, 0, i));
  }


  return micros() - start;
}


unsigned long testFilledTriangles() {
  unsigned long start, t = 0;
  int           i, cx = tft.width()  / 2 - 1,
                   cy = tft.height() / 2 - 1;


  tft.fillScreen(TFT_BLACK);
  start = micros();
  for (i = min(cx, cy); i > 10; i -= 5) {
    start = micros();
    tft.fillTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i,
                     tft.color565(0, i, i));
    t += micros() - start;
    tft.drawTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i,
                     tft.color565(i, i, 0));
  }


  return t;
}


unsigned long testRoundRects() {
  unsigned long start;
  int           w, i, i2,
                cx = tft.width()  / 2 - 1,
                cy = tft.height() / 2 - 1;


  tft.fillScreen(TFT_BLACK);
  w     = min(tft.width(), tft.height());
  start = micros();
  for (i = 0; i < w; i += 6) {
    i2 = i / 2;
    tft.drawRoundRect(cx - i2, cy - i2, i, i, i / 8, tft.color565(i, 0, 0));
  }


  return micros() - start;
}


unsigned long testFilledRoundRects() {
  unsigned long start;
  int           i, i2,
                cx = tft.width()  / 2 - 1,
                cy = tft.height() / 2 - 1;


  tft.fillScreen(TFT_BLACK);
  start = micros();
  for (i = min(tft.width(), tft.height()); i > 20; i -= 6) {
    i2 = i / 2;
    tft.fillRoundRect(cx - i2, cy - i2, i, i, i / 8, tft.color565(0, i, 0));
    yield();
  }


  return micros() - start;
}


/***************************************************
  Original Adafruit text:


  This is an example sketch for the Adafruit 2.2" SPI display.
  This library works with the Adafruit 2.2" TFT Breakout w/SD card
  ----> http://www.adafruit.com/products/1480


  Check out the links above for our tutorials and wiring diagrams
  These displays use SPI to communicate, 4 or 5 pins are required to
  interface (RST is optional)
  Adafruit invests time and resources providing this open source code,
  please support Adafruit and open-source hardware by purchasing
  products from Adafruit!


  Written by Limor Fried/Ladyada for Adafruit Industries.
  MIT license, all text above must be included in any redistribution
 ****************************************************/

Expect, sometimes there was some flickering. But all in all no visible Text, forms or colours.

Internet research and AI-Assistent couldn't help me.

Preperations:

I edited data "User_Setup.h as follow:

Display Driver:

\//#define ILI9341_DRIVER``

all other Drivers are commented out. Only:

\#define ILI9488_DRIVER``

Pins:

#define TFT_MOSI 17

#define TFT_SCLK 18

#define TFT_CS 9 // Chip select control pin

#define TFT_DC 15 // Data Command control pin

#define TFT_RST 16 // Reset pin (could connect to RST pin)

Cable management:

Additional setting:

\#define USE_HSPI_PORT``

After I uploaded some example files of the library. But no output.

Did someone stumbled across this problem and found a solution?


r/arduino 8d ago

Will heat damage conductive thread?

3 Upvotes

Hey all! This isn't about Arduino/programming specifically but I haven't found answers elsewhere and this seems like something this community might know.

I'm working on a costume and would like to sew conductive thread into the fingerpads of the gloves. The problem is the gloves will have claws as well, which I am planning to hot glue. Ideally, I would like to add the thread first so I can turn the gloves inside out to finish/tie off the ends more neatly (which won't be possible with the claws installed).

Will the heat from the hot glue affect the conductivity of the thread at all? The glue itself shouldn't ever come in contact with it, but obviously it's hot and heat radiates. I know magnets and active electronics can be damaged by heat, but I don't know whether that's something I need to worry about with the thread. If it is potentially damaging, I'll sew the threads in after the claws are installed but would prefer not to have to unless necessary. The plan is to use 3ply stainless steel yarn if that affects the answer.

Thank you so much!


r/arduino 8d ago

My Arduino not being read by my laptop

2 Upvotes

This is a issue I am facing for some time
My Arduino is not being read by my computer
When ever I try to connect it every com port is unknown and after selecting board when I click upload it just gets stuck on uploading
And while trying the online Arduino the board is not being found
Can I get some help I need to submit a project soon


r/arduino 9d ago

Elegoo uno r3 or Mega2560?

9 Upvotes

Hi, I wanted to ask if one is better for me as a first year electrical engineering student. On Amazon, the price difference is only 4 dollars. But I heard there are more tutorials for the uno and it's more beginner friendly. I also heard the mega is superior. Thanks!

(edit) There is the super starter kit as an option too, I'm just not sure what would be best suited for my level and as a beginner.


r/arduino 8d ago

Beginner Arduino RGB Painter Project Not Working (Tinkercad)

2 Upvotes

Hello everyone,

I recently started learning Arduino and decided to build a small RGB “painter” project in Tinkercad. The idea is to use 3 buttons to control an RGB LED: each button corresponds to one color channel (red, green, or blue), and when the use presses a button, that color should light up.

However, my circuit still doesn’t work properly, and I genuinely cannot figure out why after spending hours debugging it. 😭 I checked the pins, wiring, code, and button logic multiple times, but I’m still getting strange behavior from the RGB LED.

I’ve uploaded screenshots of both the circuit and the schematic, along with the code. I would really appreciate any help or suggestions on what might be wrong. Thank you!

int pin_red_button = 4;
int pin_green_button = 3;
int pin_blue_button = 2;

int pin_blue_led = 5;
int pin_red_led = 6;
int pin_green_led = 10;


void setup()
{
  pinMode (pin_red_button, INPUT_PULLUP);
  pinMode (pin_blue_button, INPUT_PULLUP);
  pinMode (pin_green_button, INPUT_PULLUP);


  pinMode(pin_green_led, OUTPUT);
  pinMode(pin_red_led, OUTPUT);
  pinMode(pin_blue_led, OUTPUT);


}

void loop()
{
  int button_state_red = digitalRead(pin_red_button);
  int button_state_green = digitalRead(pin_green_button);
  int button_state_blue = digitalRead(pin_blue_button);


  if (button_state_blue == LOW) {
    analogWrite (pin_blue_led, 255);
  }
  else {
   analogWrite (pin_blue_led, 0);
  } 


  if (button_state_red == LOW) {
    analogWrite (pin_red_led, 255);
  }
  else {
   analogWrite (pin_red_led, 0); 
  } 


  if (button_state_green == LOW) {
    analogWrite (pin_green_led, 255);
  }
  else {
   analogWrite (pin_green_led, 0); 
  } 

}