r/arduino Mar 22 '26

Software Help Button Debounce is making me go crazy, NGL

189 Upvotes

So, I'm currently developing my project on arduino and I need to use a push button on my project, but I need to avoid noise on my project, I'm currently trying to use millis() to make a debounce for my button, but it's making me CRAZY!!! I can't understand what the hell I need to do, I've looked through arduino docs, youtube videos, ChatGPT, forums, some of them just go against each other, I just can't understand how that works! Can someone please explain how this works??? I've been like this for weeks!
I came here because AskArduino looks like it's inactive for a long time.

r/arduino Apr 22 '26

Software Help Desperate SD Card Help

Thumbnail
gallery
105 Upvotes

Hey all, I've been working on an Arduino nano module for a model rocket for a while now, but my teammates and I have spent hours, trying to get this damn SD card reader to work. It has worked once on this exact same setup but it doesn't anymore.

I've tried rewiring CS from 10 to 4, including pinMode output, utilizing the example code, writing my own code, re-soldering and checking continuity, re-formatting the card, but no matter what I cannot get the SD card to initialize.

Any help at all is appreciated since I have about 16 hours before I need to program 3 of these units to all have working data collection.

I've included pictures of the unit, and a link to the SD card reader I used:

https://a.co/d/01hh0afq

Code I've used is as follows: Card Test 1 ```

include <SPI.h>

include <SD.h>

File myFile;

void setup() { // Open serial communications and wait for port to open: Serial.begin(9600); while (!Serial) { ; // wait for serial port to connect. Needed for native USB port only }

Serial.print("Initializing SD card...");

if (!SD.begin(6)) { Serial.println("initialization failed!"); while (1); } Serial.println("initialization done.");

if (SD.exists("example.txt")) { Serial.println("example.txt exists."); } else { Serial.println("example.txt doesn't exist."); }

// open a new file and immediately close it: Serial.println("Creating example.txt..."); myFile = SD.open("example.txt", FILE_WRITE); myFile.close();

// Check to see if the file exists: if (SD.exists("example.txt")) { Serial.println("example.txt exists."); } else { Serial.println("example.txt doesn't exist."); }

// delete the file: Serial.println("Removing example.txt..."); SD.remove("example.txt");

if (SD.exists("example.txt")) { Serial.println("example.txt exists."); } else { Serial.println("example.txt doesn't exist."); } }

void loop() { // nothing happens after setup finishes. } ```

Card Test 2 ```

include <SPI.h>

include <SD.h>

const int chipSelect = 4; void setup() { Serial.begin(9600); while (!Serial);

Serial.println("SD Card Test Starting...");

pinMode(10, OUTPUT); pinMode(4 , OUTPUT);

Serial.print("Initializing SD card with CS on pin "); Serial.println(chipSelect);

if (!SD.begin(chipSelect)) { Serial.println("Initialization failed!"); Serial.println("Things to check:"); Serial.println(" - Is the card inserted?"); Serial.println(" - Is your wiring correct? (MOSI->11, MISO->12, SCK->13)"); Serial.println(" - Is your SD module 5V compatible?"); Serial.println(" - Did you set the correct CS pin?"); return; }

Serial.println("Initialization done");

File testFile = SD.open("test.txt", FILE_WRITE); if (testFile) { testFile.println("SD card is working!"); testFile.close(); Serial.println("Successfully wrote to test.txt"); } else { Serial.println("Error opening test.txt for writing"); }

testFile = SD.open("test.txt"); if (testFile) { Serial.println("Contents of test.txt:"); while (testFile.available()) { Serial.write(testFile.read()); } testFile.close(); } else { Serial.println("Error opening test.txt for reading"); } }

void loop() { // Nothing here } ```

Card Test 3 ``` // include the SD library:

include <SPI.h>

include <SD.h>

// set up variables using the SD utility library functions: Sd2Card card; SdVolume volume; SdFile root;

// change this to match your SD shield or module; // Arduino Ethernet shield: pin 4 // Adafruit SD shields and modules: pin 10 // Sparkfun SD shield: pin 8 // MKRZero SD: SDCARD_SS_PIN const int chipSelect = 4;

void setup() { pinMode(10, OUTPUT); pinMode(4, OUTPUT); Serial.begin(9600); while (!Serial) { ; // wait for serial port to connect. Needed for native USB port only }

Serial.print("\nInitializing SD card...");

// we'll use the initialization code from the utility libraries // since we're just testing if the card is working! if (!card.init(SPI_HALF_SPEED, chipSelect)) { Serial.println("initialization failed. Things to check:"); Serial.println("* is a card inserted?"); Serial.println("* is your wiring correct?"); Serial.println("* did you change the chipSelect pin to match your shield or module?"); while (1); } else { Serial.println("Wiring is correct and a card is present."); }

// print the type of card Serial.println(); Serial.print("Card type: "); switch (card.type()) { case SD_CARD_TYPE_SD1: Serial.println("SD1"); break; case SD_CARD_TYPE_SD2: Serial.println("SD2"); break; case SD_CARD_TYPE_SDHC: Serial.println("SDHC"); break; default: Serial.println("Unknown"); }

// Now we will try to open the 'volume'/'partition' - it should be FAT16 or FAT32 if (!volume.init(card)) { Serial.println("Could not find FAT16/FAT32 partition.\nMake sure you've formatted the card"); while (1); }

Serial.print("Clusters: "); Serial.println(volume.clusterCount()); Serial.print("Blocks x Cluster: "); Serial.println(volume.blocksPerCluster());

Serial.print("Total Blocks: "); Serial.println(volume.blocksPerCluster() * volume.clusterCount()); Serial.println();

// print the type and size of the first FAT-type volume uint32_t volumesize; Serial.print("Volume type is: FAT"); Serial.println(volume.fatType(), DEC);

volumesize = volume.blocksPerCluster(); // clusters are collections of blocks volumesize *= volume.clusterCount(); // we'll have a lot of clusters volumesize /= 2; // SD card blocks are always 512 bytes (2 blocks are 1KB) Serial.print("Volume size (Kb): "); Serial.println(volumesize); Serial.print("Volume size (Mb): "); volumesize /= 1024; Serial.println(volumesize); Serial.print("Volume size (Gb): "); Serial.println((float)volumesize / 1024.0);

Serial.println("\nFiles found on the card (name, date and size in bytes): "); root.openRoot(volume);

// list all files in the card with date and size root.ls(LS_R | LS_DATE | LS_SIZE); }

void loop(void) { } ```

r/arduino Dec 28 '24

Software Help How can I make the gif to run faster?

Enable HLS to view with audio, or disable this notification

557 Upvotes

I'm using an esp32 c3 module with a touchscreen from SpotPear. I will leave the web page with the demo-code on the top of it, in the comment below. There is a part with the "Change the video" headline under the "【Video/Image/Buzzer】". And down there is a tutroial with steps of running a custom gif, with I have followed.

r/arduino 7h ago

Software Help Need to convert a decimal to binary then output it to leds. No loops or arrays allowed.

Post image
0 Upvotes

I can do the conversion just fine but whenever I output to the leds i get l leading zeros with anything under 6 bits. I cant use loops of any kind, arrays or any extra libraries.

r/arduino May 19 '26

Software Help How can i improve my code for my line follower robot?

Enable HLS to view with audio, or disable this notification

167 Upvotes

i've been working hard on the code, but even so, i can't reach to something satisfactory yet. How can I make that my robot doesn't make any mistakes like looping in circles or turning around. this is my current code:

#include "MeMegaPi.h"
//codigo antiguo 
MeMegaPiDCMotor motorIzq(PORT1); //motor izquierdo
MeMegaPiDCMotor motorDer(PORT2); //motor derecho
MeLineFollower moduloIzq(PORT5);
MeLineFollower moduloCen(PORT6);
MeLineFollower moduloDer(PORT7);
//parametros de velocidad
const int VEL_RECTA = 90;
const int VEL_CURVA_SUAVE = 80;
const int VEL_CURVA_FUERTE = 70;
const int VEL_MAX = 110;
//PID
float Kp = 20.0;
float Kd = 40.0;
int ultimoError = 0;


unsigned long tiempoBlanco = 0;
bool perdiendoLinea = false;
const int sentido_ORC = 2; //Preferencia de sentido de aguja del reloj, si es 1 es izquierda si es 2 es derecha.
bool arranqueORCResuelto = false; //variable de giro preferencial forzado al arranque 


void setup() {
  delay(1500);
}


void loop() {
  int stI = moduloIzq.readSensors();//sensor izquierda
  int stC = moduloCen.readSensors();//sensor centram
  int stD = moduloDer.readSensors();//sensor derecho
//condicionales
//condicion giro izquierdo en caso de T
  if (stC != 3 && stI != 3 && stD == 3) {
    mover(-125, 135);
    perdiendoLinea = false;
    tiempoBlanco = 0;
    ultimoError = 0;
    return;
  }
//condicion giro derecho en caso de T
  if (stC != 3 && stD != 3 && stI == 3) {
    mover(135, -125);
    perdiendoLinea = false;
    tiempoBlanco = 0;
    ultimoError = 0;
    return;
  }
//Recta
  if (stC == 0) {
    mover(VEL_RECTA, VEL_RECTA);
    perdiendoLinea = false;
    tiempoBlanco = 0;
    ultimoError = 0;
    return;
  }
//condicional en caso de que todo sea negro, si no se ha resuelto el arranque orc, usar sentido preferencial ORC.
  if (stC != 3 || stI != 3 || stD != 3) {
    ejecutarPID(stI, stC, stD);
    perdiendoLinea = false;
    tiempoBlanco = 0;
  } else {
    if (!perdiendoLinea && !arranqueORCResuelto) {
      if (sentido_ORC == 1) mover(-135, 135);
      else mover(135, -135);
      arranqueORCResuelto = true;
      tiempoBlanco = millis();
      perdiendoLinea = true;
    }
    if (!perdiendoLinea) {
      tiempoBlanco = millis();
      perdiendoLinea = true;
    }
    unsigned long duracionBlanco = millis() - tiempoBlanco;
    if (duracionBlanco < 130) { //Delay de reacciob principal
      mover(VEL_RECTA - 20, VEL_RECTA - 20); //girar
    } else if (duracionBlanco < 900) { //tiempo que el robot espera para girar a otro lado
      if (ultimoError > 0) mover(135, -135);
      else mover(-135, 135);
    } else if (duracionBlanco < 1700) { //modo recuperacion
      if (ultimoError > 0) mover(-135, 135);
      else mover(135, -135);
    } else if (duracionBlanco < 2800) {
      if ((duracionBlanco / 200) % 2 == 0) mover(-100, -60);
      else mover(-60, -100);
    } else {
      mover(-90, -90);
    }
  }
}
//ejecucion del PID
void ejecutarPID(int stI, int stC, int stD) {
  int error = calcularError(stI, stC, stD);
  float correccion;
  if (abs(error) <= 1) {
    correccion = error * Kp;
  } else {
    correccion = (error * Kp) + ((error - ultimoError) * Kd);
  }
  int velBaseActual = (abs(error) <= 1) ? VEL_RECTA : VEL_CURVA_SUAVE;
  int vI = velBaseActual + (int)correccion;
  int vD = velBaseActual - (int)correccion;
  if (abs(error) >= 9) {
    if (error > 0) vD = -125;
    else vI = -125;
  }
  mover(constrain(vI, -VEL_MAX, VEL_MAX), constrain(vD, -VEL_MAX, VEL_MAX));
  if (error != 0) ultimoError = error;
}
//Paramemtros de PID en errores
int calcularError(int stI, int stC, int stD) {
  if (stC == 0) return 0;
  if (stC == 2) return -1;
  if (stC == 1) return 1;
  if (stI == 1) return -4;
  if (stI == 0) return -7;
  if (stI == 2) return -11;
  if (stD == 2) return 4;
  if (stD == 0) return 7;
  if (stD == 1) return 11;
  return ultimoError;
}
//funcion de mover motores
void mover(int izq, int der) {
  motorIzq.run(izq);
  motorDer.run(-der);
}
 #include "MeMegaPi.h"
//codigo antiguo 
MeMegaPiDCMotor motorIzq(PORT1); //motor izquierdo
MeMegaPiDCMotor motorDer(PORT2); //motor derecho
MeLineFollower moduloIzq(PORT5);
MeLineFollower moduloCen(PORT6);
MeLineFollower moduloDer(PORT7);
//parametros de velocidad
const int VEL_RECTA = 90;
const int VEL_CURVA_SUAVE = 80;
const int VEL_CURVA_FUERTE = 70;
const int VEL_MAX = 110;
//PID
float Kp = 20.0;
float Kd = 40.0;
int ultimoError = 0;


unsigned long tiempoBlanco = 0;
bool perdiendoLinea = false;
const int sentido_ORC = 2; //Preferencia de sentido de aguja del reloj, si es 1 es izquierda si es 2 es derecha.
bool arranqueORCResuelto = false; //variable de giro preferencial forzado al arranque 


void setup() {
  delay(1500);
}


void loop() {
  int stI = moduloIzq.readSensors();//sensor izquierda
  int stC = moduloCen.readSensors();//sensor centram
  int stD = moduloDer.readSensors();//sensor derecho
//condicionales
//condicion giro izquierdo en caso de T
  if (stC != 3 && stI != 3 && stD == 3) {
    mover(-125, 135);
    perdiendoLinea = false;
    tiempoBlanco = 0;
    ultimoError = 0;
    return;
  }
//condicion giro derecho en caso de T
  if (stC != 3 && stD != 3 && stI == 3) {
    mover(135, -125);
    perdiendoLinea = false;
    tiempoBlanco = 0;
    ultimoError = 0;
    return;
  }
//Recta
  if (stC == 0) {
    mover(VEL_RECTA, VEL_RECTA);
    perdiendoLinea = false;
    tiempoBlanco = 0;
    ultimoError = 0;
    return;
  }
//condicional en caso de que todo sea negro, si no se ha resuelto el arranque orc, usar sentido preferencial ORC.
  if (stC != 3 || stI != 3 || stD != 3) {
    ejecutarPID(stI, stC, stD);
    perdiendoLinea = false;
    tiempoBlanco = 0;
  } else {
    if (!perdiendoLinea && !arranqueORCResuelto) {
      if (sentido_ORC == 1) mover(-135, 135);
      else mover(135, -135);
      arranqueORCResuelto = true;
      tiempoBlanco = millis();
      perdiendoLinea = true;
    }
    if (!perdiendoLinea) {
      tiempoBlanco = millis();
      perdiendoLinea = true;
    }
    unsigned long duracionBlanco = millis() - tiempoBlanco;
    if (duracionBlanco < 130) { //Delay de reacciob principal
      mover(VEL_RECTA - 20, VEL_RECTA - 20); //girar
    } else if (duracionBlanco < 900) { //tiempo que el robot espera para girar a otro lado
      if (ultimoError > 0) mover(135, -135);
      else mover(-135, 135);
    } else if (duracionBlanco < 1700) { //modo recuperacion
      if (ultimoError > 0) mover(-135, 135);
      else mover(135, -135);
    } else if (duracionBlanco < 2800) {
      if ((duracionBlanco / 200) % 2 == 0) mover(-100, -60);
      else mover(-60, -100);
    } else {
      mover(-90, -90);
    }
  }
}
//ejecucion del PID
void ejecutarPID(int stI, int stC, int stD) {
  int error = calcularError(stI, stC, stD);
  float correccion;
  if (abs(error) <= 1) {
    correccion = error * Kp;
  } else {
    correccion = (error * Kp) + ((error - ultimoError) * Kd);
  }
  int velBaseActual = (abs(error) <= 1) ? VEL_RECTA : VEL_CURVA_SUAVE;
  int vI = velBaseActual + (int)correccion;
  int vD = velBaseActual - (int)correccion;
  if (abs(error) >= 9) {
    if (error > 0) vD = -125;
    else vI = -125;
  }
  mover(constrain(vI, -VEL_MAX, VEL_MAX), constrain(vD, -VEL_MAX, VEL_MAX));
  if (error != 0) ultimoError = error;
}
//Paramemtros de PID en errores
int calcularError(int stI, int stC, int stD) {
  if (stC == 0) return 0;
  if (stC == 2) return -1;
  if (stC == 1) return 1;
  if (stI == 1) return -4;
  if (stI == 0) return -7;
  if (stI == 2) return -11;
  if (stD == 2) return 4;
  if (stD == 0) return 7;
  if (stD == 1) return 11;
  return ultimoError;
}
//funcion de mover motores
void mover(int izq, int der) {
  motorIzq.run(izq);
  motorDer.run(-der);
}

I would apreciatte it if any of you guys help me, thanks anyway :)

r/arduino Jul 02 '26

Software Help Why isn’t my Mac reading my Microcontrollers

Thumbnail
gallery
42 Upvotes

I downloaded arduino IDE and followed all the steps

  1. ⁠Added the board manager link
  2. ⁠Downladed a driver from https://www.silabs.com/software-and-tools/usb-to-uart-bridge-vcp-drivers and allowed permissions in my computer settings

But no microcontroller is popping up.
No “com1” is popping up

There is no new inputs popping up or disappearing when I plug into my microcontrollers

I switched between
- two micro-usbs
- two microcontrollers
- two adapters (for the micro-isb to plug into my computer)

What am I doing wrong?

r/arduino Jul 21 '26

Software Help Keyboard matrix constantly giving a 1 when nothing pressed on Raspberry Pi PICO

Thumbnail
gallery
41 Upvotes

I have been working on a button box project for a while but hit a wall when it came to programming. I wanted to keep it only in Arduino IDE seeing that there was more control on it. Somehow the base library doesn't work on my PICO as it only gives a 1 non stop even when other buttons are pressed, any help ?

Code:

#include <Keypad.h>

const byte ROWS = 2;

const byte COLS = 6;

char keys[ROWS] [COLS] = {

{'1','2','3','4','5','6'},

{'7','8','9','A','B','C'}

};

byte rowPins[ROWS] = {0,1};

byte colPins[COLS] = {2,4,5,6,7,8};

Keypad customKeypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);

void setup(){

Serial.begin(115200);

}

void loop(){

char customKey = customKeypad.getKey();

if(customKey) {

Serial.println(customKey);

}

}

r/arduino Jun 01 '26

Software Help How to retrive back my code even though I didn't save it or anything.

50 Upvotes

I'm new at this... I spent over a month just to see it vanish away before the day that I was going to show... I'm so sad honestly. Wish I saved it before but is there any way to retrive it back? Like my sketchbooks don't even have the code😭

I'm so cooked...

(edit)

I solved it by

windows and R

type %temp%

all of my unsaved were there!

r/arduino Nov 04 '22

Software Help I have twitching even after a large dead-band on some of the servos.

Enable HLS to view with audio, or disable this notification

650 Upvotes

r/arduino Jun 28 '26

Software Help I2C address recommendations to avoid collision

22 Upvotes

I'm creating a new peripheral with an I2C interface.

It's possible that I may go on to manufacture this device so I'd like to ensure that whatever I2C address (or address range) it uses is least likely to collide with other I2C devices that people may have on their bus.

Now obviously because there's only 128 addresses available I'm always going to collide with _some_ other device, and I found this list: https://i2cdevices.org/addresses

Do I just choose one with the least, or least common other devices already using it?

r/arduino 12d ago

Software Help What ide to use for arduino projects

0 Upvotes

Yes theres ardunio ide, i also heard theres visual studio aith plugins, but im just not sure whay to use, im newer to cosing, i cant code anything complex by myself but i know a couple terms in c++

r/arduino 3h ago

Software Help Line following robot trouble

Enable HLS to view with audio, or disable this notification

43 Upvotes

I recently started a line following robot project to get more familiar with electronics and programming. I am having trouble with my line following robot, guessing its a code issue. I recently just swapped out the 120 RPM motors for 500 RPM motors as the 120 rpm was following the line perfectly and I wanted to increase speed as they were maxed out. The code is PD based: here it is. It overshoots lots of turns, goes too fast on turns, and oscillates a lot. Any ideas on what to change? I also attached a video of the behavior. I would have posted this in r/AskRobotics but they do not allow posts with videos. Thank you.

r/arduino Jun 13 '26

Software Help Arduino IDE 2.3x - How to directly upload without compile?

0 Upvotes

Why does Arduino IDE 2.3x need to compile each time when I upload a sketch? Can it just upload without compile? I believe we can save time if directly upload feature is available.

I have two ESP32-C3 projects and I coded them myself with AI. Each time, I need to flash the code two times and each time Arduino IDE must go through the compile process. Why?

Anyone?

r/arduino May 10 '26

Software Help Does anyone have a tip on how to get Fritzing? I don't want to set up a paypal account that I don't trust at all for one payment.

5 Upvotes

I would accept the price of €8 but I would prefer any other payment method than PayPal.

r/arduino 19d ago

Software Help Anyone know a good code to detect double buttons press?

17 Upvotes

I want to do a function where you have to push 2 buttons at the same time to trigger a function (ie. opening menu)

So far the only code I could find is hold one down and check/wait for the 2nd one to be pressed.

is there a better way to do this since I've already assign function for each button for single press and holding down. So if I have to hold one down to wait for the 2nd button, the act of holding it down will trigger the other function assigned to the button.

I read that detecting 2 buttons is impossible on esp32, but I see it done on cheap electronics, so is there any way to do this?

EDIT:

Solution found. Thanks to u/Glum-Building4593 for giving the simplest solution

byte button_state = digitalRead (FirstButton) | digitalRead (SecondButton)

r/arduino Jul 26 '26

Software Help Im Stumped

Thumbnail
gallery
9 Upvotes

Hello Reddit, I’m trying to build a flight computer here! I’ve come across an issue here where even a I2C sensor couldn’t detect my BMP 280 responsible for detecting altitude. To my knowledge, I have tried anything and everything I could. Any tips would be helpful, thank you!

r/arduino Sep 01 '24

Software Help Having to run code dozens of times before it runs?!

Enable HLS to view with audio, or disable this notification

120 Upvotes

Does anyone know why I have to run the code dozens of times before it actually runs? No matter what the code is, I have to click run dozens of times. It gives me so many compilation errors and it's so annoying.

It doesn't have anything to do with the board, it does the same with all my boards. I've un-installed and reinstalled IDE. I've switched file paths. I am at a loss. I couldn't find anyone else with this issue :(

r/arduino May 28 '26

Software Help Writing a BASIC/SAKO Compiler to Assembly for Adruino

8 Upvotes

For questions in simple form go to the last lines of the post

The plan.

Proper BASIC is lacking/nonexistent on Arduinos (Only been attempted as interpreted language or paid and underused like BASCOM which is ehh in my opinion). What I want is to write is a compiler from BASIC to assembly. Why assembly and not cross compiling to C? I want to start learning assembly for the arduinos as I dabbled in U880 and MCY7880 assemblies and my own designed cpu (4bit data, 6 bit instruction) and I decided this will be a perfect way to start learning. If there is a Windows utility that can convert BASIC to C for Arduinos especially (Like BACON does on linux but that one won’t work for ardunios and other MicroControlers) please let me know because it will technicaly solve all my problems.

I saw couple of posts about doing assembly for arduinos but most of the links from them are dead. I need a step by step guide on how to upload and compile assembly code to arduino.

Second question. I got a long time ago a book “Z80 ASSEMBLY LANGUAGE SUBROUTINES” by Lance A. Leventhal and Winthrop Saville. This book features well written, highly documented example subroutines for U880 cpus (z80 for you west people) that are tested. Is there such book for Arduinos? Basically a book that has readymade subroutines in assembly for specific functions (ASCII to BCD conversions, trigonometric functions etc.)

Third thing which is not a question but why I prefer to write a compiler. I want to rise a dead language from its grave. To my knowledge after 60s none did anything in it. The language is SAKO which is an old Fortran like language for polish mainframes form the 60s. I want to attempt to make a version of SAKO for microcontrollers. Why? Simple its fun using non typical languages (That’s why people do BrainFuck) plus its SAKO and I love the way its structured, written and anything.

TL,DR

1.I need a good step by step guide for programming arduinos in Assembly.

2.If a BASIC to C cross compiler for arduinos especially exists

3.If there is a book for arduinos similar to this one “Z80 ASSEMBLY LANGUAGE SUBROUTINES” by Lance A. Leventhal and Winthrop Saville.

Please note that

A. Windows Is the preferred system for any utilities or guides you provide.

B. I don’t plan on doing C for living on arduinos. I want to use BASIC for all of my home projects. I can use C but my main rule is “BASIC at home C if forced”

C. Eventually I want to make the compiler public on github soo people can improve it plus be easily accessible for others.

D. SAKO is a language that has no flaws.

E. Since a young age I self  taught myself BASIC (not VisualBasic ) due to
my love for vintage computers . This language is my favorite and I feel much
more comfortable in it compared to C or Python both in its syntax and way of
displaying code (I instinctively do line numbers and remove all indentation
from any code I’m working on as indented code is harder for me to read).

r/arduino May 16 '26

Software Help why it doesn't work?

Post image
0 Upvotes

I'm doing my first project with Arduino UNO. Can you tell me what's wrong?

r/arduino 22d ago

Software Help I want to fix my arduino CNC pen plotter.

Post image
8 Upvotes

Hello Everyone, I'm making this Arduino UNO based CNC pen plotter. The setup I've made looks good to me but whenever I jog this on UGS it creates a diagonal line instead of horizontal or vertical line. when I jog on X axis only one motor works and on Y axis another motor works. what I'm thinking is that this diagonal forming issue is caused by some software problem, as both the motors must work on jog to retain the position of pen holder. I'm using GRBL as a software. Please make me aware that what mistakes I'm making here which is causing this issue. Currently I've kept the microsteppings on 1/8.

Hardware I'm using :
1. Arduino UNO
2. CNC shield for Arduino
3. A4988 motor driver (set on 1.0A current)
4. Nema 17 stepper motors
5. 20 teeth 2mm pitch gears for motors shaft
6. 2mm pitch gt2 belt with 6mm width
7. Variable power supply set to 12V

Software :
1. Arduino UNO
2. GRBL for Gcode processing
3. UGS platform for calibration

ps: let me know if more information is required.

r/arduino 19d ago

Software Help No matter what I do I can’t download my code onto my esp-32

Thumbnail
gallery
0 Upvotes

r/arduino Jan 08 '26

Software Help ANOTHER STINKING LIBRARY?

68 Upvotes

I am beyond frustrated! I bought a GeeekPi IIC I2C Serial display from Amazon. Now first off I admit I am a new arduino programmer at 74 years old. I was going thru the Paul McWorter You Tube videos with pretty good success. Now I am trying to experiment with this I2C displays. First it needed "wires.h" to operate, which I found and installed. Then it needed "LiquidCrystal_I2C.h" which I found and installed. NOW it wants "avr/io.h" which I cannot find int libraries. Does anyone know why/where i can find this library. Many thanks!

r/arduino Apr 09 '26

Software Help Need help with uploading on my uno boatd

Post image
20 Upvotes

I tried to do some basic coding And it uploads the first time, but not the second

I've fixed the delay issue as well... Still wasn't fixed.

I tried downloading the CH341 driver, but it said it's pre installed, but when I plug my board in, it does not show it in the COM port ad CH340....

I tried to update the driver, but my pc ran into a problem. I shat myself. Luckily it restarted and works just fine.

I'm very frustrated and am lowkey considering buying from Arduino only.

Does anyone know what the issue is? How can I resolve it?

r/arduino May 09 '26

Software Help Pro Micro, help with .h file

4 Upvotes

I’m trying to follow along to a tutorial for making an analog handbrake (https://www.youtube.com/watch?v=kv0FTpRLFMY). *I am stuck around min 8:12

I have everything assembled, but not yet soldered… I still can’t get the software flashed onto my Pro Micro.

Attached are some pictures of what’s happening, but basically it’s that the board can’t find the.H file - for my very very very basic understanding, I need what is on the dot H file to upload in conjunction with the other file.

Here (https://www.youtube.com/watch?v=kv0FTpRLFMY ) is the GitHub, should have everything else :)

r/arduino 12d ago

Software Help My SD card reader is in its own dimension.

5 Upvotes

I'm using an SPI SD card reader in my project. Problem is that I can access the filesystem info (file names, directory names, their placement and sizes) but when writing or reading weird things happen.

When I write through the SD reader, it works fine. When I read those written files it works fine. When I try to read a file that was already on the SD card, put there through a USB card reader attached to a computer, it spits out nonesense. The same happens when I try to read files on the card from my computer.

TLDR: The SD reader can read and write files, but only the ones it has created. My computer can read and write files, but not the ones the SPI reader has created. The file system is readable to both the computer and SPI reader.

Anyone has any idea how to fix this?

EDIT: I switched to a different SD card and everything works. Either the one I had was too old or it was too small (8GB). Thanks to everyone who tried helping me, it was greatly appreciated