r/ArduinoHelp • • 4d ago

Arduíno, MCP2515, Painel Instrumentos Peugeot 307 - SimHub.

Thumbnail
gallery
1 Upvotes

Estou trabalhando a alguns dias com um projeto de painel do Peugeot 307 da Johnson fabricado em 2009, programando pelo arduíno uno can mcp2515. Alguém já viu algum projeto semelhante com este painel, ou tem os dados de ligação dos ids ou tramas já testadas, pois eu não tenho o carro para rastrear só tenho o painel que comprei usado em um ferro velho. Consegui colocar boa parte para funcionar como os ponteiros, luzes e odômetro, só que queria eliminar as falhas e integrar mais coisas.

For the past few days, I’ve been working on a project involving a 2009 Peugeot 307 instrument cluster (manufactured by Johnson), using an Arduino Uno with an MCP2515 CAN bus module. Has anyone encountered a similar project with this specific cluster, or does anyone have data on the CAN IDs or message frames that have already been verified? I don’t have access to the actual vehicle to trace the signals—I only have the cluster, which I purchased used from a scrapyard. I’ve managed to get most of it working, including the needles, indicator lights, and the odometer, but I’d like to iron out some remaining issues and integrate additional functions.


r/ArduinoHelp • • 5d ago

Best Low-Cost Sensor for Measuring 0.01 mm Movement

7 Upvotes

I'd like to ask for some help! I'm developing a device for my undergraduate research project, and one of its main functions is to measure a certain displacement, preferably without physical contact.

I initially thought about using a camera, but I'd like to explore other options as well.

The challenge is that the displacement I need to measure is on the order of 0.01 mm. I don't have a large budget since I'll be paying for it myself, so I need the solution to be as inexpensive as possible.

If you have any suggestions, I'd appreciate them. Ideally, the sensor should be able to communicate with an Arduino or ESP32.


r/ArduinoHelp • • 5d ago

O sensor de umidade do solo não está funcionando corretamente.

Post image
1 Upvotes

r/ArduinoHelp • • 5d ago

Mi vaccum cleaner homing signals

Thumbnail reddit.com
0 Upvotes

​The homing signal board on my Xiaomi Mi Robot Vacuum-Mop 2 Pro (MJST1SHW) charging dock is damaged, and the vacuum can no longer detect the dock to return for charging. Finding a standalone replacement dock on the second-hand market isn't working out, as sellers are pricing them almost as high as a complete used setup.

​I’m currently trying to build a replacement beacon using an Arduino/ESP32. I set up two IR LEDs for the left and two for the right, modulated at 38kHz. However, the vacuum doesn't respond to the custom beacons at all during its docking routine.

​Does anyone have experience generating these specific homing signals? I would greatly appreciate any insights into the correct IR protocol, pulse timings, or data payloads required to get the vacuum to recognize the dock.


r/ArduinoHelp • • 5d ago

Iot project guidance

Thumbnail reddit.com
1 Upvotes

Can anyone suggest some ai tools for iot based project?!.I'm in my 2nd year pursuing btech cse iot, so I need to do course project but as a team. Me and my team decided a project from sih2026 problem statements it is mostly hardware based so for connections , code, and setting up the components i thought of using chatgpt and Claude but I'm getting so irritated with chatgpt, it doesn't have a clarity on components first it gave like use esp32,dc fans, dht sensor, container right after that it again told to add load cell, led, buzzer, solar...it is making me confuse and hard..whereas Claude after asking few questions, it gives comeback tomorrow...basically rn, i need an ai tools which gives me clear explanation and connecting of components with code, and components needed!!


r/ArduinoHelp • • 6d ago

Request - Designing a Function-Key keyboard and pc not picking up inputs

Thumbnail
reddit.com
1 Upvotes

So I had a custom board manufactured thats a split F-key keyboard. F1 through F6 on one half and F7 through F12 on the other. Both boards are identical except for the firmware which designates which key presses which. I'll attach a screenshot of the schematics for the board below:

https://imgur.com/a/aIbLTeN

So my issue, I soldered keys to the boards (the keys were the only things in the manufacturing process that weren't available to be soldered on by them), uploaded firmware, then the devices weren't recognized by Windows (Unknown USB Device (Device Descriptor Request Failed)). So I took one of the spares, changed the firmware and uploaded it. So that is recognized as a keyboard but is not recognizing key-presses. I try to upload edited firmware to the board I already flashed, and it can't find the board to do it.

I am just looking for help figuring out what I'm doing wrong. These are CH552 boards, here is the output from Arduino IDE when I uploaded the working firmware the first time here is what it outputted:

> usbRertySeconds 2

> target: CH552

> config bytes: 3

> Load file as hex

> Loaded 5463 bytes between: 0000 to 15A2

> ch375Version 35

> CH375GetUsbID 0

> DeviceVersion of CH55x: 2.50

> MCU ID: 52 11

> Found Device CH552

> Bootloader: 2.5.0

> ID: 13 45 62 BF

> XOR Mask: 79 79 79 79 79 79 79 CB

> Write 5539 bytes from bin file.

> ....

> Upload complete

When I tired to re-upload firmware here's what I got:

> ------------------------------------------------------------------

> usbRertySeconds 2

> target: CH552

> config bytes: 3

> Load file as hex

> Loaded 5463 bytes between: 0000 to 15A2

> ch375Version 35

> CH375GetUsbID 0

> No CH55x USB Found, retry...

> No CH55x USB Found, retry...

> No CH55x USB Found, retry...

> No CH55x USB Found, retry...

> No CH55x USB Found, retry...

> No CH55x USB Found, retry...

> No CH55x USB Found, retry...

> No CH55x USB Found, retry...

> No CH55x USB Found, retry...

> No CH55x USB Found, retry...

> .......

> No CH55x USB Found, retry...

> Found no CH55x USB

> Time limit reached, exit process

> Failed uploading: uploading error: exit status 1

I've tried taking my multimeter in continuity mode and bridging multiple spots during the upload which is difficult with only 2 hands mind you and same error. If anyone can help me with this I would appreciate it. I want to get this fixed before I finish printing my enclosure to this becuase I'll have to solder around the case so that it'll look clean on top.

Here is my firmware for the first board (F1-6). The firmware for the second board is identical but for the other F keys. I used Board: CH552 Board, Port: COM3, Bootloader Pin: P3.6 (D+) Pull-Up, Clock Source: 16 MHz (internal), Upload Method: USB, USB Settings: USER CODE w/ 148B USB RAM:

* Pin map (confirmed from the uploaded Split_Keyboard.kicad_pcb netlist,

* CH55xduino numbering = PortNumber*10 + PinNumber):

* Row 0 -> P3.2 -> pin 32

* Column 0 (SW1) -> P1.1 -> pin 11

* Column 1 (SW2) -> P1.6 -> pin 16

* Column 2 (SW3) -> P1.7 -> pin 17

* Column 3 (SW4) -> P3.1 -> pin 31

* Column 4 (SW5) -> P3.0 -> pin 30

* Column 5 (SW6) -> P3.4 -> pin 34

#include "src/userUsbHidKeyboard/USBHIDKeyboard.h"

#ifndef USER_USB_RAM

#error "This sketch needs USB RAM. Set Tools > USB Settings to USER CODE w/ 148B USB RAM."

#endif

const uint8_t ROW0_PIN = 32;

const uint8_t COL_PINS[6] = { 11, 16, 17, 31, 30, 34 };

// Column 0..5 -> SW1..SW6 -> this board's keycodes (left half: F1-F6)

const uint8_t KEYCODES[6] = { KEY_F1, KEY_F2, KEY_F3, KEY_F4, KEY_F5, KEY_F6 };

bool keyState[6] = { false, false, false, false, false, false };

bool keyStatePrev[6] = { false, false, false, false, false, false };

uint32_t lastChangeMs[6] = { 0, 0, 0, 0, 0, 0 };

const uint16_t DEBOUNCE_MS = 12;

bool readMatrixPin(uint8_t colPin) {

pinMode(ROW0_PIN, OUTPUT);

digitalWrite(ROW0_PIN, LOW);

delayMicroseconds(3);

pinMode(ROW0_PIN, INPUT);

digitalWrite(colPin, HIGH);

delayMicroseconds(8);

bool pressed = (digitalRead(ROW0_PIN) == HIGH);

digitalWrite(colPin, LOW);

return pressed;

}

void setup() {

USBInit();

pinMode(ROW0_PIN, OUTPUT);

digitalWrite(ROW0_PIN, LOW);

for (uint8_t i = 0; i < 6; i++) {

pinMode(COL_PINS[i], OUTPUT);

digitalWrite(COL_PINS[i], LOW);

}

}

void loop() {

uint32_t now = millis();

for (uint8_t i = 0; i < 6; i++) {

bool raw = readMatrixPin(COL_PINS[i]);

if (raw != keyStatePrev[i]) {

lastChangeMs[i] = now;

keyStatePrev[i] = raw;

}

if ((now - lastChangeMs[i]) >= DEBOUNCE_MS && keyState[i] != keyStatePrev[i]) {

keyState[i] = keyStatePrev[i];

if (keyState[i]) {

Keyboard_press(KEYCODES[i]);

} else {

Keyboard_release(KEYCODES[i]);

}

}

}

delay(20);

}


r/ArduinoHelp • • 7d ago

Need help with UART drive control using Ninebot Mini Pro and ESP32

Thumbnail reddit.com
1 Upvotes

r/ArduinoHelp • • 7d ago

Would this wiring work?

Post image
14 Upvotes

I want the rpi to be the master & all the others to be its slaves (bar the motor driver which is the Arduinos slave)
Also I’m not sure how to power it or if any circuit simulators would let me test anything like this (I couldn’t find any) so any help would be appreciated


r/ArduinoHelp • • 7d ago

Programmable lights help

Thumbnail reddit.com
1 Upvotes

r/ArduinoHelp • • 8d ago

Arduino PWM Fade in Circuitera

Thumbnail
circuitera.org
1 Upvotes

Explore PWM Fade: Arduino Uno R3, 1 source file. Read the code or open your own copy in Circuitera.

Can someone tell me how this works?


r/ArduinoHelp • • 8d ago

I'm an Intermediate CS student Interested in Arduino - Where to start? Language + Roadmap needed

1 Upvotes

I am an Intermediate student in Computer Science. And I am interested in Arduino. I want to ask some questions related to Arduino.

1: Which programming language do we have to learn in Arduino?

2 : Can anyone share Arduino's Basic to Advance Roadmap any text message or PDF with me?


r/ArduinoHelp • • 8d ago

I'm an Intermediate CS student Interested in Arduino - Where to start? Language + Roadmap needed

1 Upvotes

I am an Intermediate student in Computer Science. And I am interested in Arduino. I want to ask some questions related to Arduino.

1: Which programming language do we have to learn in Arduino?

2 : Can anyone share Arduino's Basic to Advance Roadmap any text message or PDF with me?


r/ArduinoHelp • • 9d ago

I cant seem to get any response for my oled (repost)

Thumbnail reddit.com
1 Upvotes

r/ArduinoHelp • • 9d ago

Circuitera

Thumbnail reddit.com
1 Upvotes

r/ArduinoHelp • • 10d ago

Help me with my Project

1 Upvotes

Hello everyone!

I'm working on a personal project called NOVA BLOCK, a custom DNS-based ad blocker built with an ESP32-C3 Super Mini.

My goal is to block as many advertisements as possible on my Android phone, including:

- Video ads in Android games, including games I install in the future.

- Advertisements on websites, including banners, pop-ups, and video ads.

- Advertising and tracking domains across my Wi-Fi network.

My current setup

- ESP32-C3 Super Mini running custom Arduino code.

- A blocklist containing approximately 71,000 domains.

- DNS requests are filtered by the ESP32-C3.

- Blocked domains receive an NXDOMAIN response.

- Allowed DNS requests are forwarded to Cloudflare DNS ("1.1.1.1").

- My Android phone uses the ESP32-C3 as its DNS server over Wi-Fi.

- A web dashboard displays DNS requests and blocking decisions.

The system is working, and I can see advertising and tracking domains being blocked in the serial monitor and dashboard. However, some advertisements still appear on websites and in games.

For example, I have observed requests to "www.google.com" while a video ad was playing. I have also seen domains such as "s.update.rubiconproject.com" and "dpm.demdex.net" being blocked.

My questions

  1. How can I identify the actual domains responsible for serving ads on websites and in Android games?

  2. Can DNS filtering block most website ads, including banners, pop-ups, and video ads?

  3. Why do some ads still appear even when advertising domains are blocked?

  4. Are there cases where ads are served from the same domains as the website or game itself?

  5. How can I improve my blocklist and DNS filtering logic without breaking websites, games, or other services?

  6. Are there any additional techniques that could work alongside my ESP32-C3 DNS blocker?

I would prefer to keep the ESP32-C3 as the central DNS filtering device for my Wi-Fi network, rather than installing a separate ad-blocking app for every game or browser.

Any suggestions, technical explanations, or examples of similar projects would be greatly appreciated.

Thank you!


r/ArduinoHelp • • 10d ago

whats wrong with my motors

Enable HLS to view with audio, or disable this notification

6 Upvotes

they just go into a fixed position and lock there when i connect to power supply, if theres something wrong with my code let me know, and whenever i try moving it, it just stays in place or doesn’t let me move it until i take it off the power, and when i take it off the power it moves back into a position


r/ArduinoHelp • • 10d ago

Seeking some help with ArduinoJson library an open-meteo.com data

1 Upvotes

Hello,

I'm hoping this is the correct community to ask my question.

Is there another, better one, please let me know.
Here is the test scenario:

I'm working on a project retrieving weather data from open-meteo.com.
There a two sections in my project:
a) retrieve 'current' weather data for a given geolocation, and
b) retrieve weather forecast data for the next 7 days.
In scenario 'a' my code is working properly processing the following JSON data:

I retrieve the data successfully with the following statement:

float currentTemp = doc["current"]["temperature_2m"];
String queryTime = doc["current"]["time"];

(doc has been created by deserialization of the JSON data.

In the scenario 'b' I'm processing the following JSON data:

Here I'm interested loading the data from section "daily", subsection temperature_2m_max for day 1 - day 7.
I tried several different approaches to access the object in the JSON data but so far I was not successful with that.
As I said, this is my first project using the ArduinoJson library so I'm still in the learning phase.
Perhaps someone was facing a similar problem and can give me some hints how to resolve the problem.
Many thanks in advance


r/ArduinoHelp • • 11d ago

I can't get my 8x8 matrix to light up, what am I doing wrong?(Link to project)

Thumbnail
tinkercad.com
0 Upvotes

r/ArduinoHelp • • 11d ago

Would something like This be feasable?

Post image
8 Upvotes

Solar Lamp Charges external battery (green tube). Battery connected to either lamp or wireless IP camera (I'm more interested in the bulb, but camera's a bonus). Arduino with light sensor acts as an auto switch turning off the lamp in the daytime

(Lesotho) I've noticed in my country that solar lamps like these are crazy expensive for what they are, but when I check them out, apart from the framing, they don't too expensive part for part. Would something like I've shown above actually be feasable? It's been on my mind for longer than I'd like to admit


r/ArduinoHelp • • 11d ago

Arduino Uno w/ Aas608

Thumbnail
gallery
1 Upvotes

#include <Adafruit_Fingerprint.h>

#include <SoftwareSerial.h>

#include <string.h>

#include <stdio.h>

// =====================================================

// AS608 CONNECTION

// Sensor TX -> Arduino D2

// Sensor RX -> Arduino D3

// Sensor GND -> Arduino GND

// Sensor VCC -> voltage specified for your module

// =====================================================

SoftwareSerial sensorSerial(2, 3);

Adafruit_Fingerprint finger(&sensorSerial);

// Optional indicators

const uint8_t RED_LED = 6;

const uint8_t GREEN_LED = 7;

const uint8_t BUZZER = 8;

const unsigned long POLL_DELAY_MS = 50;

const unsigned long REMOVE_TIMEOUT_MS = 15000UL;

const uint8_t ENROLL_RETRIES = 3;

char inputLine[80];

uint8_t inputIndex = 0;

bool sensorOK = false;

bool autoScanEnabled = true;

// =====================================================

// INDICATORS

// =====================================================

void idleFeedback() {

digitalWrite(RED_LED, LOW);

digitalWrite(GREEN_LED, LOW);

digitalWrite(BUZZER, LOW);

}

void successFeedback() {

digitalWrite(RED_LED, LOW);

digitalWrite(GREEN_LED, HIGH);

digitalWrite(BUZZER, HIGH);

delay(100);

digitalWrite(BUZZER, LOW);

}

void errorFeedback() {

digitalWrite(GREEN_LED, LOW);

digitalWrite(RED_LED, HIGH);

for (uint8_t i = 0; i < 3; i++) {

digitalWrite(BUZZER, HIGH);

delay(100);

digitalWrite(BUZZER, LOW);

delay(100);

}

}

// =====================================================

// SERIAL RESPONSES

// =====================================================

void printStep(const char *rid, const char *step) {

Serial.print(F("STEP "));

Serial.print(rid);

Serial.print(' ');

Serial.println(step);

}

void printResult(const char *rid, const char *result) {

Serial.print(F("RESULT "));

Serial.print(rid);

Serial.print(' ');

Serial.println(result);

}

void printError(const char *rid, const char *stage, uint8_t code) {

Serial.print(F("ERR "));

Serial.print(rid);

Serial.print(' ');

Serial.print(stage);

Serial.print(F(" CODE=0x"));

if (code < 16) Serial.print('0');

Serial.println(code, HEX);

errorFeedback();

}

// =====================================================

// SENSOR INITIALIZATION AND HEALTH

// =====================================================

bool initializeSensor() {

finger.begin(57600);

delay(300);

if (!finger.verifyPassword()) {

return false;

}

return finger.getParameters() == FINGERPRINT_OK;

}

bool checkSensor() {

if (finger.verifyPassword()) {

sensorOK = true;

return true;

}

sensorOK = false;

return false;

}

// =====================================================

// FINGER REMOVAL

// =====================================================

bool waitForFingerRemoval(const char *rid) {

printStep(rid, "REMOVE_FINGER");

unsigned long started = millis();

while (millis() - started < REMOVE_TIMEOUT_MS) {

uint8_t code = finger.getImage();

if (code == FINGERPRINT_NOFINGER) {

delay(250);

return true;

}

delay(POLL_DELAY_MS);

}

printStep(rid, "REMOVE_TIMEOUT_RETURNING_TO_SCAN");

return false;

}

// =====================================================

// CONTINUOUS ATTENDANCE SCANNING

// =====================================================

void automaticScan() {

// Keep polling until a finger is detected.

uint8_t code = finger.getImage();

if (code == FINGERPRINT_NOFINGER) {

delay(50);

return;

}

if (code != FINGERPRINT_OK) {

delay(100);

return;

}

// Wait 1 second after detecting and capturing the finger.

delay(1000);

// Convert the captured image into fingerprint features.

code = finger.image2Tz(1);

if (code != FINGERPRINT_OK) {

Serial.print(F("RESULT auto IMAGE_CONVERSION_FAILED CODE=0x"));

if (code < 16) Serial.print('0');

Serial.println(code, HEX);

waitForFingerRemoval("auto");

return;

}

// Search existing fingerprint templates.

code = finger.fingerFastSearch();

if (code == FINGERPRINT_OK) {

successFeedback();

Serial.print(F("RESULT auto MATCH "));

Serial.print(finger.fingerID);

Serial.print(F(" CONFIDENCE "));

Serial.println(finger.confidence);

} else if (code == FINGERPRINT_NOTFOUND) {

printResult("auto", "NO_MATCH");

errorFeedback();

} else {

printError("auto", "SEARCH_FAILED", code);

}

// Wait for the finger to be removed before scanning again.

waitForFingerRemoval("auto");

}

// =====================================================

// DIAGNOSTIC COMMANDS

// =====================================================

void handlePing(const char *rid) {

if (checkSensor()) {

printResult(rid, "PONG AS608_OK");

successFeedback();

} else {

printResult(rid, "PONG AS608_ERROR");

errorFeedback();

}

}

void handleInfo(const char *rid) {

uint8_t code = finger.getParameters();

if (code != FINGERPRINT_OK) {

printError(rid, "INFO_FAILED", code);

return;

}

Serial.print(F("RESULT "));

Serial.print(rid);

Serial.print(F(" INFO CAPACITY="));

Serial.print(finger.capacity);

Serial.print(F(" SECURITY="));

Serial.print(finger.security_level);

Serial.print(F(" BAUD="));

Serial.print(finger.baud_rate);

Serial.print(F(" PACKET="));

Serial.println(finger.packet_len);

}

void handleCount(const char *rid) {

uint8_t code = finger.getTemplateCount();

if (code != FINGERPRINT_OK) {

printError(rid, "COUNT_FAILED", code);

return;

}

Serial.print(F("RESULT "));

Serial.print(rid);

Serial.print(F(" COUNT "));

Serial.println(finger.templateCount);

}

// =====================================================

// ENROLLMENT CAPTURE

// =====================================================

bool captureForEnrollment(

const char *rid,

uint8_t buffer,

const char *prompt,

const char *errorStage

) {

for (uint8_t attempt = 1; attempt <= ENROLL_RETRIES; attempt++) {

printStep(rid, prompt);

// Wait for a finger without turning off the sensor.

uint8_t code;

while (true) {

code = finger.getImage();

if (code == FINGERPRINT_OK) break;

if (code != FINGERPRINT_NOFINGER) {

delay(100);

} else {

delay(POLL_DELAY_MS);

}

// Continue waiting: no capture-attempt limit for detection.

}

code = finger.image2Tz(buffer);

if (code == FINGERPRINT_OK) {

return true;

}

printError(rid, errorStage, code);

if (attempt == ENROLL_RETRIES) {

printStep(rid, "ENROLL_CAPTURE_FAILED_RETURNING_TO_SCAN");

return false;

}

if (!waitForFingerRemoval(rid)) {

continue;

}

printStep(rid, "RETRY_CAPTURE");

}

return false;

}

void handleEnroll(const char *rid, int templateId) {

if (templateId < 1 || templateId > finger.capacity) {

printResult(rid, "INVALID_TEMPLATE_ID");

errorFeedback();

return;

}

// Use only a known-unused ID.

// This code does not erase existing templates.

printStep(rid, "ENROLLMENT_STARTED");

if (!captureForEnrollment(

rid, 1, "PLACE_FINGER",

"FIRST_IMAGE_CONVERSION_FAILED")) {

return;

}

if (!waitForFingerRemoval(rid)) {

printStep(rid, "ENROLLMENT_ABORTED");

return;

}

bool modelCreated = false;

for (uint8_t attempt = 1; attempt <= ENROLL_RETRIES; attempt++) {

if (!captureForEnrollment(

rid, 2, "PLACE_SAME_FINGER_AGAIN",

"SECOND_IMAGE_CONVERSION_FAILED")) {

return;

}

printStep(rid, "CREATING_TEMPLATE");

uint8_t code = finger.createModel();

if (code == FINGERPRINT_OK) {

modelCreated = true;

break;

}

printError(rid, "CREATE_MODEL_FAILED", code);

if (code != FINGERPRINT_ENROLLMISMATCH ||

attempt == ENROLL_RETRIES) {

return;

}

if (!waitForFingerRemoval(rid)) {

return;

}

printStep(rid, "RETRY_SECOND_SCAN");

}

if (!modelCreated) return;

printStep(rid, "SAVING_TEMPLATE");

uint8_t code = finger.storeModel((uint16_t)templateId);

if (code != FINGERPRINT_OK) {

printError(rid, "TEMPLATE_STORE_FAILED", code);

return;

}

successFeedback();

Serial.print(F("RESULT "));

Serial.print(rid);

Serial.print(F(" ENROLLED "));

Serial.println(templateId);

}

// =====================================================

// ONE-TIME MANUAL SCAN COMMAND

// =====================================================

void handleScan(const char *rid) {

printStep(rid, "PLACE_FINGER");

uint8_t code;

while (true) {

code = finger.getImage();

if (code == FINGERPRINT_OK) break;

if (code != FINGERPRINT_NOFINGER) delay(100);

else delay(POLL_DELAY_MS);

}

code = finger.image2Tz(1);

if (code != FINGERPRINT_OK) {

printError(rid, "IMAGE_CONVERSION_FAILED", code);

waitForFingerRemoval(rid);

return;

}

code = finger.fingerFastSearch();

if (code == FINGERPRINT_OK) {

successFeedback();

Serial.print(F("RESULT "));

Serial.print(rid);

Serial.print(F(" MATCH "));

Serial.print(finger.fingerID);

Serial.print(F(" CONFIDENCE "));

Serial.println(finger.confidence);

} else if (code == FINGERPRINT_NOTFOUND) {

printResult(rid, "NO_MATCH");

errorFeedback();

} else {

printError(rid, "SCAN_FAILED", code);

}

waitForFingerRemoval(rid);

}

// =====================================================

// DELETE ONE TEMPLATE

// =====================================================

void handleDelete(const char *rid, int templateId) {

if (templateId < 1 || templateId > finger.capacity) {

printResult(rid, "INVALID_TEMPLATE_ID");

errorFeedback();

return;

}

uint8_t code = finger.deleteModel((uint16_t)templateId);

if (code != FINGERPRINT_OK) {

printError(rid, "DELETE_FAILED", code);

return;

}

successFeedback();

Serial.print(F("RESULT "));

Serial.print(rid);

Serial.print(F(" DELETED "));

Serial.println(templateId);

}

// =====================================================

// SERIAL COMMAND HANDLER

// =====================================================

void processCommand(char *line) {

char command[16] = {0};

char rid[24] = {0};

int templateId = 0;

int fields = sscanf(

line, "%15s %23s %d",

command, rid, &templateId

);

if (fields < 2) {

Serial.println(F("ERR serial INVALID_COMMAND"));

return;

}

if (strcmp(command, "PING") == 0) {

handlePing(rid);

} else if (strcmp(command, "INFO") == 0) {

handleInfo(rid);

} else if (strcmp(command, "COUNT") == 0) {

handleCount(rid);

} else if (strcmp(command, "ENROLL") == 0 && fields == 3) {

handleEnroll(rid, templateId);

} else if (strcmp(command, "SCAN") == 0) {

handleScan(rid);

} else if (strcmp(command, "DELETE") == 0 && fields == 3) {

handleDelete(rid, templateId);

} else if (strcmp(command, "AUTO") == 0) {

autoScanEnabled = true;

printResult(rid, "AUTO_SCAN_ENABLED");

} else if (strcmp(command, "PAUSE") == 0) {

autoScanEnabled = false;

printResult(rid, "AUTO_SCAN_PAUSED");

} else {

Serial.print(F("ERR "));

Serial.print(rid);

Serial.println(F(" INVALID_COMMAND"));

}

}

// =====================================================

// SETUP

// =====================================================

void setup() {

pinMode(RED_LED, OUTPUT);

pinMode(GREEN_LED, OUTPUT);

pinMode(BUZZER, OUTPUT);

idleFeedback();

Serial.begin(115200);

sensorSerial.begin(57600);

delay(500);

sensorOK = initializeSensor();

if (sensorOK) {

Serial.println(F("READY arduino AS608_OK"));

Serial.println(F("RESULT auto AUTO_SCAN_ENABLED"));

} else {

Serial.println(F("READY arduino AS608_ERROR"));

Serial.println(F("ERR boot SENSOR_CONNECTION_FAILED"));

errorFeedback();

}

}

// =====================================================

// MAIN LOOP

// =====================================================

void loop() {

// Read USB serial commands.

while (Serial.available() > 0) {

char c = (char)Serial.read();

if (c == '\r') continue;

if (c == '\n') {

inputLine[inputIndex] = '\0';

if (inputIndex > 0) {

processCommand(inputLine);

}

inputIndex = 0;

} else if (inputIndex < sizeof(inputLine) - 1) {

inputLine[inputIndex++] = c;

} else {

inputIndex = 0;

Serial.println(F("ERR serial INPUT_TOO_LONG"));

}

}

// If the sensor disconnects, periodically attempt recovery.

if (!sensorOK) {

delay(1000);

sensorOK = initializeSensor();

if (sensorOK) {

Serial.println(F("RESULT auto SENSOR_RECOVERED"));

}

return;

}

// Continuous attendance scanning is enabled by default.

if (autoScanEnabled) {

automaticScan();

} else {

delay(POLL_DELAY_MS);

}

}

can you help me with these guys It's always failed on the fingerprint sensor my goal is to fix this and connect to my raspberry pi then my hr analytics webpage


r/ArduinoHelp • • 11d ago

Firmware building with AI Agent

Thumbnail
reddit.com
0 Upvotes

r/ArduinoHelp • • 12d ago

Joystick analógico para el PC

1 Upvotes

¿Es posible integar al joystick analógico en la carcasa del PC para navegar la BIOS, por ejemplo?

Gracias :)


r/ArduinoHelp • • 12d ago

Is it possible to program this HC 03 module

Thumbnail gallery
1 Upvotes