Questions tagged [programming]

The process of designing and writing source code as part of a program (or sketch) for Arduino. For questions about uploading code to an Arduino board, use the [uploading] tag instead.

Filter by
Sorted by
Tagged with
-1
votes
0answers
25 views

Encrypted communication system using AVR atmega 328p [closed]

can anyone please help me with the following question? "Design and develop an encrypted communication system with password and user id authentication. You can use any communication mode with any ...
0
votes
0answers
15 views

problem with Arduino robotic hand, nrf2401 red light [closed]

I'm making a robotic hand and I upload code to both the transmitter and receiver, however when I bend the flex sensor the servos don't move but instead the nrf2401 just has a singular red light on ...
1
vote
2answers
21 views

How to properly put a u8g2 handle in a class

I'm trying to create a small battery powered alarm clock using an Arduino MKRZero and a generic SH1106-controlled, 128x64 pixel oled. I started out just dumping all code into a single file named Clock....
0
votes
1answer
81 views

Detecting an incoming 7.875 kHz pulse to use as trigger

I have written a code that detects an incoming pulse (square) of 7.875 kHz to trigger the output High for the entire duration of pulse, and trigger the output low if the pulse is off or not detected. ...
1
vote
1answer
36 views

More effecient datalogging code

Background: I am using a Teensy 3.6 to data log over a dozen sensors. I am printing to Serial1 for local Serial access, Serial3 for remote access (via xbee, same data is on Serial1 as on Serail3, just ...
0
votes
1answer
25 views

Please , explain about MAX30100 using for Arduino to read ADC in format (0-1023)

can anyone help me..? I am using MAX30100 with arduino, and my expectation is i can to process the ADC as usual (0-1023), but I do not understand the signal processing. Has anyone used the MAX30100 ...
0
votes
1answer
26 views

Why is their need of response time needed in esp8266 AT commands?

I am writing an AT commands firmware for esp8266 via connecting it to atmega2560. Now the question is how will I come to know the response time for AT commands for writing its firmware to read the ...
1
vote
1answer
43 views

inconsistent digital output on simple code

so im new on arduino coding, and i made this code, where i input from serial monitor and then use it as a command for digital write. the problem is, sometimes the code work perfectly but then when i ...
0
votes
0answers
45 views

Digispark Atinny85 not recognized (bootloader problem)

I recently bought the Attiny85 (picture below) I managed to install it correctly following the official guides, never that a problem. Drivers are installed correctly, and I used the Arduino IDE to ...
-2
votes
0answers
26 views

I have 2 Arduino programs that work separately. How can I merge them? [duplicate]

IMPORTANT* I am new to this. A virgin to code I dont understand the millis function I have two solutions in mind but uncertain of how to format Solution 1) use scheduler / or millis to ledR high for ...
1
vote
2answers
210 views

What exactly does the return type do in a function?

something I've never understood and still don't is, what does the return type do specifically? Everyone in tutorials just say that void returns nothing and int returns int, etc. But what does that ...
0
votes
0answers
21 views

Arduino Due Master Programming

I am newbie. In my application Arduino Due is configured as Master and Arduino Uno as Slave. I need to transfer 24-bit Hexadecimal data of about 79-registers to slave device. At the slave end in ...
0
votes
1answer
57 views

If the code used for Arduino can be embedded into a permanent , callable memory, is there a way to create an OS for Arduino that runs on call?

This thought came into my mind on thinking about smartwatches. Although those I saw on YouTube are really good, they don't seem to provide a real experience of a real smartwatch - one that has an OS ...
0
votes
1answer
37 views

How can I assign the value of a char array to a uint8_t array?

I have a char array variable that has a value. I need to send this value through LoRa. The library I use for the LoRa implementation accepts an array of uint8_t. How can I pass the value of a char[] ...
0
votes
0answers
67 views

esp8266 Arduino error : esptool.FatalError: Failed to write compressed data to flash after seq 1 (result was C100)

i have simple circuit for controlling the dc motor by bjt BC869 like this: and this code: /* ESP8266 Blink by Simon Peter Blink the blue LED on the ESP-01 module This example code is in the ...
0
votes
1answer
56 views

How do I generate a graph from Arduino sensor data?

I used a DHT 11 sensor with an Arduino Uno to measure temperature and humidity. I used the following code to print the temperature and relative humidity in Serial Monitor. dht DHT; #define DHT11_PIN ...
1
vote
2answers
66 views

How to convert Unicode char to “Unicode HEX Position” in Arduino

How to convert Unicode char to "Unicode HEX Position" in Arduino or C i will share a picture here : for example in JavaScript you can do that with charCodeAt(); ! this function will return ...
0
votes
1answer
47 views

Run a part of a code only 4 second

I have two different programs written for my Arduino. One control the rockets thrust vector. The other one is for parachute. I need to first run rotationmatrices() for a 4 second and then parachute. ...
1
vote
1answer
33 views

I want to program multiple arduino at once

I am aware that using a USB Hub you can attach multiple arduino to one computer and either upload code one by one or use bash script to upload code on all arduinos together. But you can attach only as ...
0
votes
0answers
40 views

Program Nano Every using UPDI port

I have and Arduino Nano and an Arduino Nano Every. I'm doing some experiments and trying to program the Nano Every from the Nano, using the UPDI port. I'm using tutorials like this one that does the ...
0
votes
0answers
29 views

Arduino glitches and makes 240 < 7 and -240 > 7

I'm experimenting with the joystick and the MAX7219 module (8x8 LED display) and i made this program: #include "LedControl.h" LedControl lc=LedControl(11,13,10,1); int Xo = 36; int Yo = 34;...
0
votes
2answers
43 views

How to convert RGB values to Intensity

I made an arduino color sensor with tcs3200 and arduino uno. I have coded the arduino to find the RGB values when I place the color paper below the sensor. How can I derive the intensity using the RGB ...
0
votes
1answer
32 views

Why is there a need of use delay() after using Serial.flush() in the program

This code is a part of a long code for understanding serial communication and the functions related to it. char buffer[18]; int red, green, blue; int RedPin = 11; int GreenPin = 10; int BluePin = 9; ...
0
votes
0answers
67 views

Can the Arduino Pro (Portenta H7) communicate between threads?

I have an application that runs a stepper motor from an Arduino board. This requires use of the delayMicroseconds(int us) to control the speed at which the motor turns. For this reason, all code ...
0
votes
0answers
45 views

Is there a way for an Arduino to flash another one without a computer?

I am going to create a game console. The games will be in an SD card and an Arduino (or an Atmega chip) will read a hex file's contents to RAM and will flash it to another one. Something like this but ...
5
votes
4answers
2k views

What are the traditional ways to optimize program memory usage?

While doing big projects using Arduino boards (Uno, Atmega328P MCU). I used to get warnings like this Sketch uses 13764 bytes (44%) of program storage space. Maximum is 30720 bytes. Global variables ...
0
votes
0answers
22 views

Defining a function before a class makes the class undefined? (MWE provided) [duplicate]

In ArduinoIDE 1.8.12 this code will Verify successfully: struct myINT { int i; }; myINT makeINT() { return myINT{5}; } void setup() {} void loop() {} ...no surprise, right? However this won't: ...
-1
votes
1answer
49 views

How to get data out of loop?

hi i wrote a code(i modified it actually, please forgive me, im in a mess please help me if you can) for my esp8266 to serial communicate with at tiny 85 ,it will monitor switch state and publish ...
0
votes
1answer
36 views

Getting enum name from enum instance [closed]

Hello Arduino Stack Exchange, I have an an enum instance called state: enum States { SLEEP, AWAKE, CRAZY } state; States state = SLEEP; I would like to convert the value of state to a String so ...
1
vote
2answers
70 views

Fast random booleans

I am looking for a way of generating booleans rapidly. For booleans, one usually uses random(0,2); but in my case I need about 250 booleans and calling random every time is slow. So I thought about ...
0
votes
2answers
39 views

what is good practice around initializing variables

Should vars be initialed when declared or in setup fuction? Safe to assume compiler will initialze? Boolean x; --- init to true/false here? Void setup() . . --- or init here? . Void ...
0
votes
0answers
37 views

Construct char arrays within function

I'm pretty new to C++ / Arduino code, please bear with me. Following code currently gives me a Exception (28): epc1=0x40201287 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000. I ...
0
votes
1answer
50 views

Using RX TX pin

Can i use pin RX TX on Arduino Uno as reguler pin ? . For input and output pin , because two digital pin on my board doesn’t work . Thank’s
0
votes
1answer
73 views

Attiny85 microcontroller programming without arduino

I have decided to make a simple project so thinked about arduino but that seems very worthy so i decided to use attiny85 ic for my project,but i don't have arduino or avr to program it. Is there any ...
0
votes
1answer
27 views

Boolean Logic With Chars For Motor Input Selection

Context of the code: I am trying to control 2 DC motors through an H-gate, this means there are 4 inputs in total: For DC motor 1: Input 1 (VCC) and Input 2 (GND). For DC motor 2: Input 3(VCC) and ...
0
votes
1answer
40 views

Assigning an empty array row to reference [duplicate]

int colors[][3] = { { 255, 0, 0 }, { 0, 255, 0 }, { 0, 0, 255 }, { 253, 7, 210 } }; int (*EXCLUSIVE_COLOR)[3]; I have a two-dimensional array to store some color values. I have a 2nd ...
0
votes
1answer
75 views

How can I list only files that begin with “/LOG?”

Trying to list root directory of LittleFS; but only files beginging with "/LOG." String str; if (!LittleFS.begin()) { Serial....
0
votes
1answer
15 views

Can I check if a message has been sent successfully using Radiohead_ASK?

I'm new to Arduino programming and I'm trying to get a simple 433 MHz transmitter and receiver module working on an Arduino Uno board. Unsurprisingly, it's not working as expected and I'm trying to ...
-1
votes
1answer
22 views

Stopping a motor after a given time period [duplicate]

I have a code to turn on a LED when IR Proximity sensor having a object less than 6cm in front of it, and the LED goes down after it is removed. Now, I want the LED to run for 3 seconds only, even if ...
0
votes
1answer
74 views

Stopping the program after 1 second

I am a Beginner in Arduino Programming. I am working on a project where I control A DC motor with IR sensor and arduino. Until here it is fine. But I want the Motor to stop after one second even ...
0
votes
1answer
39 views

About ATTINY85 Development Board

I am thinking to buy one of "ATTINY85 Development Board"... Before buying I was checking details/Advantages of it. First I thought this is just a breakout board & USB for power. But, then found ...
0
votes
1answer
38 views

Matrix and State Space Arduino Implementation

I wrote an Arduino Matrix class. Then I used this class to implement State Space on Arduino. During tests I stomped upon a problem. After starting the program it stops at some point. I have no idea ...
1
vote
2answers
64 views

Bike Gear Indicator Coding Problem

Lack of practice I forgot many function of C & C++... Can anyone help me with this coding Please... I think this is The Main coding: Topic: Gear indicator I first found this, Gear_Indicator_Raw ...
0
votes
1answer
35 views

what is causing my esp8266 setup function to reinitialise?

Here is code I have written: #include <stdio.h> #include <ESP8266WebServer.h> #define MAX_WIFI_INIT_RETRY 50 #define WIFI_RETRY_DELAY 500 const char* wifi_ssid = "ssid"; const char* ...
0
votes
1answer
41 views

Getting error invalid conversion from 'const char*' to 'const uint8_t*

I have written this sketch, and I am trying to populate the array of wifi hotspots to set the value in html select using javascript dynamically. #include <Arduino.h> #include <Hash.h> #...
0
votes
1answer
26 views

trying to make wemos d1 code modular causes collect2: error: ld returned 1 exit status exit status 1

#include "connection.h" void setup() { Serial.begin(115200); Funcs::Connect conn; conn.connectWifi(); } void loop() { } then connection.h file: // connection.h namespace Funcs { class ...
0
votes
1answer
73 views

Arduino Project Interrupt Error?

I have a project to be made i.e. water Billing System using RFID(Mfrc522) on Arduino NANO. There is one difficulty that I haven't been able to overcome. I hope someone could help me out. Project flow: ...
0
votes
0answers
29 views

combinate two codes [duplicate]

i am trying to put these two codes together someone would be so kind to help me. ""#include const int photores = A0; // Photo resistor input const int pot = A1; // Potentiometer input const int led =...
0
votes
0answers
31 views

Need help Coding Adafruit v1 motor shield for 3 DC motors [duplicate]

My project is that I am building an animated (singing, dancing, head turning, and arm waving) snowman. I have 3 DC motors for individual functions that are to be run via Arduino Adafruit V1 card ...
0
votes
1answer
62 views

FC-16 led matrix module based on MAX7219

EDIT: const char *pc[NUM_ZONES] = { "ROOM", //0 "SUBJECT", //1 "GRADE",//2 }; I did this and I can't get them to display every row simultaneously. void loop(void) { DateTime now = rtc....

1
2 3 4 5
30