r/ArduinoHelp

▲ 2 r/ArduinoHelp+1 crossposts

Help PLEASE (13 internal error)

I'm getting "13 INTERNAL" error while trying to install esp32 by espressif in boards manager. I've tried EVERYTHING. Disabling antivrius, deleting tmp and staging, files, re installing arduino IDE, putting github link in preferences, trying installing older version of esp in boards manager. And its still not fixed.

I also tried manually installing the file from github, but whenever I run get.py it throws a "Certificate not valid" error Somebody help me please I've legit been trying to fix this since 4 hours 😭 😭

Additional info: I'm using latest version of Arduino.

reddit.com
u/Fun_Employment_9656 — 2 days ago
▲ 5 r/ArduinoHelp+1 crossposts

Any project ideas?

This kit was originally made for an obstacle avoiding car,but the sensors got lost in the shipping . I'm a total beginner

u/alissonburgers1945 — 2 days ago
▲ 101 r/ArduinoHelp+5 crossposts

Built a $13.80 AR heads-up display that clips onto any glasses frame

Been working on this for a few months. AR glasses are either $700 or locked down. Wanted something open and cheap so I built one. I would really appreciate comments on your genuine feedback, don't worry criticism is also accepted!!!!

How it works:
ESP32-C3 drives a 0.42" OLED. A 90° prism redirects the light upward into a piece of teleprompter glass — the same semi-reflective glass used in TV studios. That overlays the image on your view of the world. Whole optical chain costs under $5.

Right now it can:
Turn-by-turn navigation arrows and notifications over BLE from your phone. Full day battery on a 500mAh LiPo. Clips onto any existing glasses frame.

BOM:
ESP32-C3 + OLED $6.90 , prism $1.50, teleprompter glass $0.90 , 3D printed housing $1.20maybe less, misc $1.50 = $13.80 total

https://preview.redd.it/zj431l0swoah1.png?width=340&format=png&auto=webp&s=63b906f2c7a847bbdfd872c0c1ceabd29edce829

Still testing daylight visibility — that's the biggest unsolved problem. Everything else works.

Putting firmware on GitHub under GPL v3 and hardware files under CERN OHL v2 later on, making it open source.

What would you build on top of this? And also, do you think it would be reasonable to spend approx 30-40 euros on this? Been thinking of making some money on the side, being a student, just want to get some feedback if there even is a market for this.

https://preview.redd.it/vcjpls7twoah1.png?width=426&format=png&auto=webp&s=38434ba213c6e4cb7149322204f16ed26ce88f66

reddit.com
u/Ok_Flower5151 — 4 days ago

Using DS3231 RTC to move Servo Arm at specific time

First time arduino user here. I'm trying to program it to move a servo arm at a specific time of the day. I did some troubleshooting and it doesn't like the line DateTime now = rtc.now() line for some reason.

#include <Wire.h>
#include "RTClib.h"
#include <Servo.h>


RTC_DS3231  rtc;
Servo myServo;


int pos = 0; 
// Set your target execution time here (24-hour format)
const int targetHour = 20;   // 2 PM
const int targetMinute = 55; // 30 minutes
bool adjustedToday = false;


void setup() {


Serial.begin(9600);
  myServo.attach(9);
  myServo.write(0); // Default startup position
}


void loop() {
 DateTime now = rtc.now(); // Get current time data



   //Check if current time matches the target hour and minute
  if (now.hour() == targetHour && now.minute() == targetMinute) {
    if (!adjustedToday) {
      myServo.write(90); // Move servo to 90 degrees
      delay(2000);       // Wait for 2 seconds
      myServo.write(0);  // Return to 0 degrees
      
      adjustedToday = true; // Mark done so it doesn't loop continuously during that minute
   }
 }


 // Reset the trigger flag at midnight so it can run again the next day
  if (now.hour() == 0 && now.minute() == 0) {
   adjustedToday = false;




 delay(1000); // Polling delay to reduce processor load
  }
}

I used this code to set the time on the RTC

#include <Wire.h>
#include "RTClib.h"


RTC_DS3231 rtc;


void setup() {
  // put your setup code here, to run once:


  Serial.begin(9600);
  Wire.begin();
// Set RTC using the compile time
  rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
}


void loop() {}
reddit.com
u/TemporarySyrup3728 — 3 days ago

Issues running 2 28BYJ-48 stepper motors

Hi all,

I'm working on a project where I have two 28BYJ-48 stepper motors with ULN2003 drivers running 'winches' from a Mega 2560.

So far I've got both stepper motors running smoothly when independent and from their own power supply (one is from the board and another from another power supply). I'm tracking the motors movement with rotary encoders at the other end of the winch drum and using the Accelstepper library to run the motors to and from preset encoder positions.

When I try to combine the program to run both simultaneously they get very jittery, stopping and starting at random intervals. From some reading I gather this could be a power supply issue, however their power supplies are separate and work fine independently. I'm wondering if there are conflicts in my code that are causing this problem.

When run, the program reads the saved EEPROM value for the position of the encoder (enc). looks at the first value in the cue array and moves towards this. When reached, it moves towards the next array value until it reaches it, then stops. I've basically duplicated this for each motor, is this too much for the arduino to handle at once, causing delays in the running of the program?

Code below and any advice would be much appreciated. Thanks.

'

#include <AccelStepper.h>
#include <EEPROM.h>


#define HALFSTEP 8


#define enc1A 26     // Encoder Outputs
#define enc1B 27
#define enc2A 48
#define enc2B 49


#define W1Pin1 25     // Winch 1 Pins
#define W1Pin2 24
#define W1Pin3 23
#define W1Pin4 22


#define W2Pin1 53     // Winch 2 Pins
#define W2Pin2 52
#define W2Pin3 51
#define W2Pin4 50


int W1Speed = 900;    // Winch set Speeds
int W2Speed = -900;
int speed1;
int speed2;


bool W1endMov = 0;    // Bool to singulate end direction switch
bool W2endMov = 0;


int enc1Pos;              // Encoder positioning decs
int enc1MemAddress = 1;


int enc2Pos;
int enc2MemAddress = 3;


unsigned long encMemStart;      // Mem Display Clock
unsigned long encMemCurrent;
const unsigned long encMemDispPeriod = 3000;


int cueList[] = {30, 70};     // Cue array
int W1cueNum = 0;
int W2cueNum = 0;


int enc1State;     // Encoder reference readings
int enc1LState;
int enc2State;
int enc2LState;


AccelStepper winch1(HALFSTEP, W1Pin1, W1Pin3, W1Pin2, W1Pin4);      // Winch pin set up
AccelStepper winch2(HALFSTEP, W2Pin1, W2Pin3, W2Pin2, W2Pin4);


void setup()
{
  Serial.begin(9600);       // Begin Serial
  delay(5000);
  Serial.println();
  Serial.println("SERIAL BEGAN");
  Serial.println();
  delay(2000);


  winch1.setMaxSpeed(950);      // Set winch max speeds
  winch2.setMaxSpeed(950);


  pinMode(enc1A, INPUT);      // Encoder pin modes
  pinMode(enc1B, INPUT);
  pinMode(enc2A, INPUT);
  pinMode(enc2B, INPUT);


  enc1Pos = EEPROM.read(enc1MemAddress);     // Read Last Saved Encoder Position from EEPROM
  enc2Pos = EEPROM.read(enc2MemAddress);
  Serial.println();
  Serial.println("Encoder Values Obtained"); delay(100);
  Serial.print("Enc1Pos: "); Serial.print(enc1Pos); Serial.print(" Enc2Pos: "); Serial.println(enc2Pos);
  Serial.println();
  delay(2000);


  encMemStart = millis();     // Zero clock and start prompt
  Serial.println("START");


  delay(500);


  enc1LState = digitalRead(enc1A);      // Read current encoder pulse states
  enc2LState = digitalRead(enc2A);
}


void loop()
{
    speed1 = W1Speed;
    speed2 = W2Speed;
    winch1.setSpeed(speed1);
    winch2.setSpeed(speed2);


  if (W1cueNum == 0)          // WINCH 1 CUE 1
  {
    if (enc1Pos >= cueList[0])
    {
      speed1 = -W1Speed;
      winch1.setSpeed(speed1);
      winch1.runSpeed();
    } 
    if (enc1Pos <= cueList[0])
    {
      speed1 = W1Speed;
      winch1.setSpeed(speed1);
      winch1.runSpeed();
    }
  }
  if (enc1Pos == cueList[0] && W1endMov == 0)    
  {
    W1endMov = 1;
    winch1.stop(); 
    Serial.println();
    Serial.println("WINCH ONE CUE ONE REACHED");
    Serial.println();
    W1cueNum ++;   
  }


  if (W2cueNum == 0)          // WINCH 2 CUE 1
  {
    if (enc2Pos >= cueList[0])
    {
      speed2 = -W2Speed;
      winch2.setSpeed(speed2);
      winch2.runSpeed();
    } 
    if (enc2Pos <= cueList[0])
    {
      speed2 = W2Speed;
      winch2.setSpeed(speed2);
      winch2.runSpeed();
    }
  }
  if (enc2Pos == cueList[0] && W2endMov == 0)    
  {
    W2endMov = 2;
    winch2.stop(); 
    Serial.println();
    Serial.println("WINCH TWO CUE ONE REACHED");
    Serial.println();
    W2cueNum ++;   
  }


  if (W1cueNum == 1)      // WINCH 1 CUE 2
  {
    if (enc1Pos >= cueList[1])
    {
      speed1 = -W1Speed;
      winch1.setSpeed(speed1);
      winch1.runSpeed();
    } else {
      speed1 = W1Speed;
      winch1.setSpeed(speed1);
      winch1.runSpeed();
    }
  }
  if (enc1Pos == cueList[1] && W1endMov == 1)
  {
    W1endMov = 0;
    winch1.stop(); 
    Serial.println();
    Serial.println(" WINCH ONE CUE TWO REACHED, WINCH ONE CUES COMPLETED");
    Serial.println();
    W1cueNum ++;  
  }
  
  if (W2cueNum == 1)      // WINCH 2 CUE 2
  {
    if (enc2Pos >= cueList[1])
    {
      speed2 = -W2Speed;
      winch2.setSpeed(speed2);
      winch2.runSpeed();
    } else {
      speed2 = W2Speed;
      winch2.setSpeed(speed2);
      winch2.runSpeed();
    }
  }
  if (enc2Pos == cueList[1] && W2endMov == 1)
  {
    W2endMov = 0;
    winch2.stop(); 
    Serial.println();
    Serial.println(" WINCH TWO CUE TWO REACHED, WINCH TWO CUES COMPLETED");
    Serial.println();
    W2cueNum ++;  
  }


  enc1State = digitalRead(enc1A);      // Encoder 1 Trips
  if(enc1State != enc1LState)
  {
    if(digitalRead(enc1B) != enc1State)
    {
      enc1Pos --;
    } else {
      enc1Pos ++;
    }
    Serial.print("W1Cue#: ");
    Serial.print(W1cueNum);
    Serial.print(" -- Encoder 1 Position: ");
    Serial.print(enc1Pos);
    Serial.print(" -- Speed: ");
    Serial.print(winch1.speed());
    Serial.print(" -- Motor Step Position: ");
    Serial.println(winch1.currentPosition());
    EEPROM.write(enc1MemAddress, enc1Pos);
  }
  enc1LState = enc1State;


  enc2State = digitalRead(enc2A);      // Encoder 2 Trips
  if(enc2State != enc2LState)
  {
    if(digitalRead(enc2B) != enc2State)
    {
      enc2Pos ++;
    } else {
      enc2Pos --;
    }
    Serial.print("W2Cue#: ");
    Serial.print(W2cueNum);
    Serial.print(" -- Encoder 2 Position: ");
    Serial.print(enc2Pos);
    Serial.print(" -- Speed: ");
    Serial.print(winch2.speed());
    Serial.print(" -- Motor Step Position: ");
    Serial.println(winch2.currentPosition());
    EEPROM.write(enc2MemAddress, enc2Pos);
  }
  enc2LState = enc2State;


  encMemCurrent = millis();      // Display Memory Value For Enc 1 and 2 Every 3 Seconds
  if (encMemCurrent - encMemStart >= encMemDispPeriod)
  {
    Serial.print("Mem Pos Enc1: "); Serial.print(EEPROM.read(enc1MemAddress));
    Serial.print(" || Mem Pos Enc2: "); Serial.println(EEPROM.read(enc2MemAddress));
    encMemStart = encMemCurrent;
  }


}'
reddit.com
u/EnglishFellow — 3 days ago
▲ 16 r/ArduinoHelp+1 crossposts

Arduino débute

Moi je suis un débutant et ma mère vient de m'acheter un kit arduino uno débutant et je voudrais savoir s'il y'a des personne qui auront de très bonnes idées de projets

La photo du kit est en haut

u/Candid-Response-4862 — 4 days ago
▲ 2 r/ArduinoHelp+2 crossposts

HOW TO INTERGRATE THE SH1107 SPI OLED SCREEN TO THE XIAOZHI AI

I am working on an ESP32-S3 project using Xiaozhi AI. By default, the system is designed to support an I2C OLED display. However, I modified the project to use a 1.5-inch SPI SH1107 OLED instead of the default I2C display.

I have already updated parts of the code to support SPI, and the project builds successfully without errors. The AI system itself is working correctly — it boots up and I can interact with it through voice conversation as expected.

However, the OLED display is not working. The screen remains blank and does not show any output even though the system is running normally.

Help Needed

I need help with:

  • Proper configuration for using an SPI SH1107 OLED instead of the default I2C OLED
  • Identifying what I may have missed in the display driver or initialization code
  • Ensuring the display output is correctly mapped and initialized in Xiaozhi AI
  • Any working reference or example for SPI OLED integration with this system
u/Opposite-Spread1442 — 5 days ago

i tried to build a clock with 4 digit 7 segment display it isnt working i dont understand why

I'm new to learning arduino. I tried to make a clock. I looked up videos on yt to wire it they used resistors to wire the segment pins instead of the digital ones when i later searched it up others were putting the resistors on the digital pins. So now I'm thinking that's what caused issues with the screen, different segments are giving different amounts of light. but when im trying to simulate it with cirkit it still isnt working properly. THEN i tried to just make a normal timer following a different YouTube video exactly and it still isnt working like normal AND NEITHER IS THE CIRKIT SIMULATION. i feel like im going crazy

here is the code and diagram

u/actuallyabaldoldman — 8 days ago

Is arduino sufficient/strong enough for an outdoor water level sensor meant to measure the level of a river?

So for context, my friend and I are fresh grads trying to help our local community by doing a simple level sensor for one of the rivers. I believe these are the only necessary components bar the power supply and chassis?

Arduino or something like arduino but better
Submersible Hydrostatic Pressure Sensors
Siren/Alarm
LED Industrial

Arduino was the first thing that came to mind because well, it's the only thing I have experience with. I was also thinking raspberry pi but it seems too much for a project that can probably be done with a microcontroller like arduino, I don't think a minicomputer is all that necessary. But at the same time, I think an arduino is far too weak for this. I mean, I have this bias that it's used mainly in diy basic stuff, certainly not for something of a pretty large scale like this that requires lasting materials.

Thank you!

reddit.com
u/RelationshipSea1446 — 11 days ago

soldering

so im learning soldering. i have 2 basic good soldering irons. i have problem with placing that solder onto a joint - solder sticks on my tip or randomly anywhere but not the joint. i do use flux, but it burns fast and intense, i try to apply solder but it doesnt even melt. also with tinning my tip, i do it, but mostly i end up with a completely messy black and blue at the back tip that barely melts solder. someone please help i already completely burned my first perf board and im doing right now a complex project, dont wanna destroy any sensor again.

reddit.com
u/garammararam — 10 days ago
▲ 2 r/ArduinoHelp+1 crossposts

Help! I need an Aux Signal Stepdown Method

So I've got this MSGEQ7 chip to analyze the frequency of music coming in from a standard AUX input jack. Only problem is that the signal is so high the chip's reading 1024 on nearly every band. The obvious solution is to put a voltage divider between the AUX and the chip... but I bought the chip on a breakout board that has the AUX input already hooked up. I know that limits me pretty significantly (in my defense the chip itself shipped 2-3 weeks out for twice the price; the board was was 3 days for cheaper), but is there a way to make this work without tearing the board apart?

reddit.com
u/AjackTheGreater1 — 8 days ago
▲ 22 r/ArduinoHelp+1 crossposts

Why is my sensitive sound sensor not working?

It remains HIGH all the time as in in the serial monitor always shoes 1 I tried changing the potentiometer but no use this is the code

Chatgpt says that I should use AO instead of DO but what's the problem i want to do it by DO

int sensor = 2; // Connected to digital output of KY-038 sound sensor module int led = 13; // Connected to postive of led boolean is_on = false; //To determine/track if led is on or off

void setup() { pinMode(sensor, INPUT); //Setting the pin to input for reading data pinMode(led, OUTPUT); //Setting the pin to output for turning the led on/off

}

void loop() {

int data = digitalRead(sensor); //Reading data from sensor and storing in variable

if (data == 1) { // 1 is sent from sensor when loud noise is detected if (is_on == true) { // If led is on then turn it off digitalWrite(led, LOW); is_on = false; } else { // else if led is off then turn it on digitalWrite(led, HIGH); is_on = true; } } }

u/Prestigious-Dog7186 — 11 days ago

Ultrasonic Sensor fail after second trigger

Hello, all --

I've been designing a "mimic" using an old chest, a linear actuator, and a speaker system. Everything had been working fine enough on desktop testing a few weeks ago, but now I'm getting a stalled loop after a second triggering event.

In short:

Ultrasonic Sensor is measuring distance.

If distance < 85", play from the mp3 queue

if distance < 36", play from mp3 queue, and activate the linear actuator. Wait 5s. Reverse linear actuator.

The problem I'm encountering is that the sensor will register either status, and it will work fine for exactly one loop, then the whole thing stalls out and it bricks up on me and I have to reset it.

It ONLY happens after the < argument is triggered for a second time. The first time through it works perfectly. I cannot figure out why this is happening. Can anyone please help?

#include &lt;DFRobotDFPlayerMini.h&gt;


#include &lt;SoftwareSerial.h&gt;


int rxPin = 5;
int txPin = 6;


SoftwareSerial fxSerial (rxPin, txPin);
DFRobotDFPlayerMini fxPlayer;


const int openPin = 7;
const int closePin = 8;
const int ENAPin = 9;
const int trigPin = 10;
const int echoPin = 11;


float duration;
float distanceCM;
float distanceIN;



void setup() {
  Serial.begin(9600);
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  pinMode(openPin, OUTPUT);
  pinMode(closePin, OUTPUT);
  pinMode(ENAPin, OUTPUT);
  pinMode(rxPin, INPUT);
  pinMode(txPin, OUTPUT);


  fxSerial.begin(9600);
  fxPlayer.begin(fxSerial);
  fxPlayer.volume(30);
  delay(1000);


}


void loop() {
  // Close the box
  digitalWrite(closePin, HIGH);
  digitalWrite(openPin, LOW);
  digitalWrite(ENAPin, 250);
 // start with a clean signal
 digitalWrite(trigPin, LOW);
 delayMicroseconds(20);
 // send trigger signal
 digitalWrite(trigPin, HIGH);
 delayMicroseconds(10);
 digitalWrite(trigPin, LOW);
 // return pulse duration in microseconds
 // if set to HIGH, pulseIn() waits for the pin to go from LOW to HIGH
 // stops timing when pin goes back LOW
 duration = pulseIn(echoPin, HIGH, 99991);
 // convert m/s to in/microsec
 // 343 m/s = 0.034 cm/microseconds
 distanceCM = (duration * 0.034) / 2;
 // convert to inches, 1 in = 2.54cm
 distanceIN = distanceCM / 2.54;
 // print distance
 Serial.print("Distance: ");
 Serial.print(distanceCM);
 Serial.print(" cm | ");
 Serial.print(distanceIN);
 Serial.println(" in"); 
 delay(100);


if (distanceIN &lt;= 85) {
    if (distanceIN &lt;= 36) {
        Serial.println("!!!ROAR!!!");
        fxPlayer.play(random(1, 8));
        digitalWrite(openPin, HIGH);
        digitalWrite(closePin, LOW);
        digitalWrite(ENAPin, 250);
        delay(5000);
        digitalWrite(openPin, LOW);
        digitalWrite(closePin, HIGH);
        digitalWrite(ENAPin, 250);
        delay(1500);
    } else {
        Serial.println("=GROWL=");
        fxPlayer.play(random(1, 8));
        delay(1500); 
    }
} else {
    Serial.println("=Shhhh=");
    digitalWrite(closePin, HIGH);
    digitalWrite(openPin, LOW);
    digitalWrite(ENAPin, 250);
}


}

The Code:

reddit.com
u/MagnusMagi — 10 days ago

Help me to understand this code !!!

This is the basic code to toggle the led on and off using a Button. With the help of paul McWhorter this works fine but I don't understand why it works...please someone help me with that...

int ledPin = 12;
int buttonPin =8;
int ledstate = 0;
int swi_old = 1;
int swi_new;
int dt = 100;

void setup() {
  // put your setup code here, to run once:
  pinMode(ledPin, OUTPUT);
  pinMode(buttonPin, INPUT);

}

void loop() {
  // put your main code here, to run repeatedly:

  swi_new = digitalRead(buttonPin);

  if(swi_old == 0 &amp;&amp; swi_new == 1)
  {
    if(ledstate == 0)
    {
      digitalWrite(ledPin, HIGH);
      ledstate = 1;
    } 
    else
    {
      digitalWrite(ledPin, LOW);
      ledstate = 0;
    }


  }
  swi_old = swi_new;
  delay(dt);

}

```

reddit.com
u/VezTheAce — 11 days ago
▲ 15 r/ArduinoHelp+1 crossposts

How do I display a digital clock on the HD44780 display in CRUMB Circuit Simulator?

I need to create a functional digital clock in CRUMB. I've never worked with circuits before. I believe the clock is working, but it's not displaying correctly; only meaningless characters are appearing. I will include the specifications I followed, the connections, and the code I put in Main.c:

Display HD44780 Arduino NANO
1 (VSS) GND
2 (VDD) 5V
3 (V0) 5V
4 (RS) D12
5 (RW) GND
6 (E) D11
11 (D4) D5
12 (D5) D4
13 (D6) D3
14 (D7) D2
15 (A) 5V + resistor 220Ω
16 (K) GND

1. Power source (DC 12V)

Source 12V Arduino NANO
Positive (+) VIN
Negative (-) GND

Code in Main.c

#define RS 12

#define E 11

#define D4 5

#define D5 4

#define D6 3

#define D7 2

int h = 12;

int m = 0;

int s = 0;

unsigned long tmp = 0;

void cmd(unsigned char c) {

digitalWrite(D4, (c >> 4) & 1);

digitalWrite(D5, (c >> 5) & 1);

digitalWrite(D6, (c >> 6) & 1);

digitalWrite(D7, (c >> 7) & 1);

digitalWrite(RS, 0);

digitalWrite(E, 1);

delay(50);

digitalWrite(E, 0);

delay(50);

digitalWrite(D4, c & 1);

digitalWrite(D5, (c >> 1) & 1);

digitalWrite(D6, (c >> 2) & 1);

digitalWrite(D7, (c >> 3) & 1);

digitalWrite(E, 1);

delay(50);

digitalWrite(E, 0);

delay(50);

}

void dat(unsigned char d) {

digitalWrite(D4, (d >> 4) & 1);

digitalWrite(D5, (d >> 5) & 1);

digitalWrite(D6, (d >> 6) & 1);

digitalWrite(D7, (d >> 7) & 1);

digitalWrite(RS, 1);

digitalWrite(E, 1);

delay(50);

digitalWrite(E, 0);

delay(50);

digitalWrite(D4, d & 1);

digitalWrite(D5, (d >> 1) & 1);

digitalWrite(D6, (d >> 2) & 1);

digitalWrite(D7, (d >> 3) & 1);

digitalWrite(E, 1);

delay(50);

digitalWrite(E, 0);

delay(50);

}

void init() {

pinMode(RS, 1);

pinMode(E, 1);

pinMode(D4, 1);

pinMode(D5, 1);

pinMode(D6, 1);

pinMode(D7, 1);

delay(200);

cmd(0x33);

delay(50);

cmd(0x32);

delay(50);

cmd(0x28);

delay(50);

cmd(0x0C);

delay(50);

cmd(0x06);

delay(50);

cmd(0x01);

delay(100);

}

void pos(int c, int r) {

if(r == 0) cmd(0x80 + c);

else cmd(0xC0 + c);

}

void print(char *t) {

while(*t) dat(*t++);

}

void num(int n) {

dat('0' + n / 10);

dat('0' + n % 10);

}

void setup() {

init();

pos(0, 0);

print(" RELOGIO ");

pos(0, 1);

print(" DIGITAL ");

delay(3000);

init();

}

void loop() {

if(millis() - tmp >= 1000) {

tmp = millis();

s++;

if(s >= 60) {

s = 0;

m++;

if(m >= 60) {

m = 0;

h++;

if(h >= 24) {

h = 0;

}

}

}

pos(0, 0);

print("Hora: ");

num(h);

dat(':');

num(m);

dat(':');

num(s);

print(" ");

pos(0, 1);

if(h >= 12) print(" PM ");

else print(" AM ");

if(s % 2 == 0) print(" [*] ");

else print(" [ ] ");

}

}

u/NoGround6989 — 12 days ago
▲ 10 r/ArduinoHelp+1 crossposts

ButtonMatrix problem on Teensy 4.1

I am working on a project replicating the omnichord which requires a custom keyboard. For this, I chose to use the Teensy 4.1 for its pins and audio capabilities. I had a previous version on ESP-32 limited by the pins where I had the keyboard functional, but upon migrating to the Teensy board I have run into troubles

On the teensy, when pressing certain buttons (mainly on row 1, a few on row 2, and none on row 3) the value and the consecutive value both trigger. I have vigourously tested if my diodes were the problem, but after these tests and considering its perfect working condition on ESP-32, I was led to the conclusion it was either something wrong with the Teensy pins (written out in program) I am using or the program itself.

I have also tried working with multiple other keyboard matrix libraries, including the one native to the Teensy, but none have the features I need for this project. I have included pictures of my matrix and wires as well as the code I currently have, and I would appriciate any input you might have. Thanks!

Specific Library link : https://github.com/ReneRichterDE/ButtonMatrix

#include &lt;Arduino.h&gt;
#include "ButtonMatrix.h" 
#include "Wire.h"


volatile int button = '0';
volatile int lastButton = '0';
using namespace RSys;


static const uint32_t c_uiMonitorBaud = 115200; 


const uint8_t ROWS = 3; 
  const uint8_t COLS = 13; 


  Button buttons[ROWS * COLS] = {
  1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 37,
  13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 28,
  25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 39
};
  uint8_t rowPins[ROWS] = {38,39,40}; 
  uint8_t colPins[COLS] = {5,6,7,8,9,10,11,12,26,27,28,29,30}; 
  


ButtonMatrix matrix((Button*)buttons, rowPins, colPins, ROWS, COLS);


void setup()
{


  
  pinMode(4, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(2, OUTPUT);
  // column pins: inputs, external pull-ups
  for (int i = 0; i &lt; COLS; i++) {
    pinMode(colPins[i], INPUT_PULLUP);
  }


  matrix.init();  
}



void loop()
{ 
   pollKeyboard();
}



void pollKeyboard() {
  Button* pButton = NULL;
  const uint16_t numButtons = matrix.getNumButtons();
  
  /*if(!matrix.update() &amp;&amp; button != 37){
     button = -1;
  }
  */
  //button = -1;


  if (matrix.update()) {


    for (uint16_t idx = 0; idx &lt; (numButtons-1); idx++) {
      pButton = matrix.getButton(idx);


      if (pButton-&gt;isPressed()) {
        Serial.print("Button pressed: ");
        Serial.println(pButton-&gt;getNumber());
        button = pButton-&gt;getNumber();



      }
    }
  }
  //delayMicroseconds(10);
  
}
u/East_Loquat2349 — 11 days ago
▲ 5 r/ArduinoHelp+1 crossposts

What is the best cheapest way to attach servos to a rod like in the picture ?

This is a home project, i'm wondering what parts i should use to connect the servos to the rods.

  1. The rods can be thinner.
  2. I will be using around 20-30 servos so i want the connection between the rod and servo to be as cheap as possible.
  3. I want to be able to slide the servo side to side to adjust distances between servos.

I'm thinking maybe metal hose clamp (zip tie with screw), but how do i connect it to the servo ?

u/ameofonte — 12 days ago

Any experiences with Learningelectronics.com?

I recently checked out learning electronics.com as a way to learn arduino in a more systematic way. I am a STEM teacher and I want to learn more about it over the summer to teach my students in the fall. It is $39/month which seemed a bit high considering the free resources out there. The thing is, the course seemed well-organized.

Has anyone on the sub seen and used this site as a learning tool? Was the fee worth it in your opinion?

Thanks!

reddit.com
u/lewislatimercoolj — 11 days ago

In need of guidance on a project

I'm fairly comfortable with basic electronics projects, but I've never done anything with arduino before. I have a project where I need to make or find a proximity sensor of sorts. Here's roughly what I need.

I need to be able to trigger a sound, vibration, or both on object A when it gets close (approximately 0-6 feet) to object B. Both objects will move dynamically in three dimensions, so transmitter(s) and receiver(s) would need to be omnidirectional. The lighter and smaller the better. Power would need to be provided by batteries.

I'm hoping someone can help with a good place for me to start on this project, or if anyone knows of an existing product that does this.

reddit.com
u/landomakesstuff — 12 days ago